Over-exposed classes in Java: An empirical study |
| |
Affiliation: | 1. ISISTAN, Tandil, Argentina;2. Department of Computer Science (DCC), University of Chile, Chile;3. CONICET, Argentina;4. CIC, Argentina;1. Department of Computer Engineering and Information Technology, Amirkabir University of Technology (Tehran Polytechnic), P.O. Box: 15875-4413, Tehran, Iran;2. School of Computer Science, Institute for Research in Fundamental Sciences (IPM), P.O. Box: 19395-5746, Tehran, Iran;1. Artificial Intelligence Department, Universidad Politécnica de Madrid, Spain;2. Computer Science Department, Universidad Autónoma de Madrid, Spain |
| |
Abstract: | Java access modifiers regulate interactions among software components. In particular, class modifiers specify which classes from a component are publicly exposed and therefore belong to the component public interface. Restricting the accessibility as specified by a programmer is key to ensure a proper software modularity. It has been said that failing to do so is likely to produce maintenance problems, poor system quality, and architecture decay. However, how developers uses class access modifiers or how inadequate access modifiers affect software systems has not been investigated yet in the literature.In this work, we empirically analyze the use of class access modifiers across a collection of 15 Java libraries and 15 applications, totaling over 3.6M lines of code. We have found that an average of 25% of classes are over-exposed, i.e., classes defined with an accessibility that is broader than necessary. A number of code patterns involving over-exposed classes have been formalized, characterizing programmers? habits. Furthermore, we propose an Eclipse plugin to make component public interfaces match with the programmer?s intent. |
| |
Keywords: | Class accessibility Modularity Over-exposed classes Java systems |
本文献已被 ScienceDirect 等数据库收录! |
|