DocumentCode :
599962
Title :
Measuring Inappropriate Generosity with Access Modifiers in Java Systems
Author :
Zoller, C. ; Schmolitzky, A.
Author_Institution :
Dept. of Inf., Univ. of Hamburg, Hamburg, Germany
fYear :
2012
fDate :
17-19 Oct. 2012
Firstpage :
43
Lastpage :
52
Abstract :
Every element of a software architecture, e.g. a subsystem, package, or class, should have a well-defined interface that exposes or hides its sub elements according to the principles of information hiding and encapsulation. Similar to other object-oriented programming languages, Java supports defining interfaces on several levels. The accessibility of types, methods, and fields can be restricted by using access modifiers. With these modifiers, developers are able to define interfaces of packages and classes tailored for different groups of clients. However, in programming practice, types and members seem to be often declared with too generous access modifiers, i.e. they are accessible by more clients than necessary. This can lead to unwanted dependencies and software quality degradation. We developed an approach to measuring the usage of access modifiers for types and methods in Java by defining two new software metrics: Inappropriate Generosity with Accessibility of Types (IGAT) and Inappropriate Generosity with Accessibility of Methods (IGAM). Furthermore, we created a tool called Access Analysis that calculates and displays these metrics. Using Access Analysis, we conducted a survey on twelve open source Java projects. The results support our assumption that access modifiers are often chosen more generously than necessary. On average, around one third of all type and method access modifiers fall into this category. Especially top-level types are almost always declared as public, so that package interfaces typically expose more types than necessary. Only 2% of all investigated top-level types are encapsulated inside their package.
Keywords :
Java; application program interfaces; data encapsulation; object-oriented programming; public domain software; software architecture; software metrics; software packages; software quality; software tools; AccessAnalysis tool; IGAM; IGAT; Java systems; access modifiers; inappropriate generosity with accessibility of methods; inappropriate generosity with accessibility of types; information encapsulation; information hiding; open source Java projects; package interfaces; software architecture; software metrics; software quality degradation; top-level types; Encapsulation; Java; Programming; Software; Software metrics;
fLanguage :
English
Publisher :
ieee
Conference_Titel :
Software Measurement and the 2012 Seventh International Conference on Software Process and Product Measurement (IWSM-MENSURA), 2012 Joint Conference of the 22nd International Workshop on
Conference_Location :
Assisi
Print_ISBN :
978-1-4673-3127-2
Electronic_ISBN :
978-0-7695-4840-1
Type :
conf
DOI :
10.1109/IWSM-MENSURA.2012.15
Filename :
6472565
Link To Document :
بازگشت