(In order to fully appreciate this paper, it is necessary that the reader
first digest the fundamentals of encapsulation theory, see, "Fundamentals," to the left.)
Encapsulation theory fundamentals introduced the concepts of potential
coupling and the isoledensal configuration efficiency of a system, defining
this configuration efficiency as, "That proportion of potential coupling a
system expresses over and above its minimum possible potential coupling"
By, "Configuration," here we mean the complete specification of the system's
encapsulated regions, the program units contained within these encapsulated
regions and whether each program unit is information-hidden within its
encapsualated region. For example, a system may comprise three subsystems into
which one hundred program units are unequally divided. The configuration of
this system is thus fully specified by stating that the system is split into
three subsystems, the exact numbers of program units in each and the exact
number of public program units in each.
By, "Efficiency," we mean the degree to which a system's configuration
approaches that of the same system after having undergone an ideal,
isoledensal transformation to minimise the potential coupling of that
system. Roughly speaking, the efficiency is a measure of how well a system
minimises its potential coupling: a configuration efficiency of 1.0 means that
a system is perfectly encapsulated with no extraneous potential coupling; a
configuration efficiency of 0.0 means that is completely unencapsulated.
If we presume that one of the goals of the programmer is to minimise the
potential coupling of the system under development, then a goal must also be
to raise the configuration efficiency of that system as high as possible,
i.e., as close to 1.0 as possible.
This survey takes a random selection of the Java systems available at
sorceforge.org and presents their configuration efficiencies. The randomness
is achieved by taking the first projects found using a search criteria
of, "Java." Projects that fail to install or contain less than 40
classes are ignored. Results for some well-known open-source projects are
also presented.
The Fractality tool (see, "Downloads") is used to parse the systems, and
the systems will be parsed at the third graph, that is, the encapsulation of
program units into subsystems is the subject of this study - for Java systems
program units are classes and subsystems are packages.
Table 1 presents the number of Java classes, the potential coupling and the
isoledensal configuration efficiency per sampled system. The table also
shows the isoledensal configuration efficiency limit, that is, the configuration
efficiency of the system as it grows indefinitely large with
the current ratio of public classes to total classes. Details of the
systems studied are listed in the appendix in section 4.
|
Number of classes
|
Potential coupling
|
Isoledensal configuration efficiency
|
Isoledensal configuration efficiency limit
|
JavaOneOne
|
1,528
|
1,523,672
|
0.5
|
0.39
|
Java 2 XML Binding
|
3,943
|
12,476,646
|
0.22
|
0.20
|
Java DjVu Viewer
|
87
|
5,666
|
0.4
|
0.29
|
Java Assembling Language
|
49
|
2,272
|
0.12
|
0.04
|
VI Toolkit for Java
|
4,016
|
14,305,173
|
0.13
|
0.11
|
XML to Java Binding
|
1,104
|
988,920
|
0.22
|
0.19
|
EJE (Everyone's Java Editor)
|
156
|
19,497
|
0.33
|
0.49
|
Jasmin - a Java assembler name
|
677
|
390,188
|
0.21
|
0.16
|
Prism for Java
|
127
|
13,554
|
0.23
|
0.18
|
Joj - Java Version of Java
|
126
|
15,402
|
0.08
|
0.02
|
DW4J Document Warehouse for Java
|
11,827
|
107,247,083
|
0.24
|
0.23
|
Java compiler & operators overloading
|
610
|
242,995
|
0.5
|
0.37
|
Java Mozilla Html Parser
|
204
|
35,612
|
0.23
|
0.16
|
Jdec: Java Decompiler
|
850
|
565,375
|
0.31
|
0.24
|
JDBWC - Java JDBC via PHP
|
279
|
66,104
|
0.22
|
0.16
|
JNode: new Java Operating System
|
13,463
|
143,316,730
|
0.22
|
0.21
|
Jeeves
|
47
|
2,000
|
0.12
|
0.08
|
JBoss
|
34,692
|
954,374,367
|
0.21
|
|
SmallSQL Database - Java DBMS
|
161
|
25,170
|
0.04
|
0.73
|
Java Clazz Utils
|
188
|
33,054
|
0.10
|
0.06
|
OpenGL[tm] for Java[tm]
|
69
|
3,947
|
0.27
|
0.18
|
Extensible Java Profiler
|
123
|
12,729
|
0.27
|
0.20
|
CyberToolbox for Java
|
192
|
36,370
|
0.01
|
0.01
|
jMechanic
|
1,263
|
1,255,811
|
0.27
|
0.22
|
Java XML Mapping (JXM)
|
1,059
|
933,602
|
0.21
|
0.17
|
JAud
|
110
|
11,747
|
0.03
|
0.02
|
Java Object Binding
|
937
|
757,648
|
0.17
|
0.14
|
Eclipse
|
39,174
|
936,485,551
|
0.40
|
0.39
|
Spring
|
1,554
|
1,841,400
|
0.27
|
0.24
|
FitNesse
|
586
|
270,599
|
0.28
|
0.22
|
Jinx
|
151
|
15,189
|
0.49
|
0.35
|
Java Object Relation
|
165
|
23,315
|
0.24
|
0.28
|
Abacus Java GUI Builder
|
3,016
|
6,222,119
|
0.35
|
0.32
|
PrEd
|
1,034
|
868,594
|
0.23
|
0.19
|
JPF
|
430
|
136,934
|
0.37
|
0.28
|
pBeans
|
445
|
162,707
|
0.24
|
0.20
|
Curl ORB for java
|
230
|
42,309
|
0.31
|
0.23
|
JScript
|
131
|
16,667
|
0.04
|
0.02
|
GlassFish
|
12,186
|
116,350,519
|
0.23
|
0.21
|
Berkeley DB Java Edition
|
622
|
271,485
|
0.41
|
0.31
|
Table 1: Analysed systems.
Before examining the data of Table 1 several sources of potential error must
be acknowledged.
Firstly, the equation for the configuration efficiency is based on an
approximation and does not take into account semantic distortion.
Secondly, all the systems analysed are presumed to reside within a
non-hierarchical encapsulation context, without extra-linguistic rules to
constrain source code dependencies. Any such design rules may radically reduce
the potential coupling of such systems and hence invalidate their data here.
Thirdly, all systems are analysed in their entirety: no attempt was made to
distinguish between the core systems and any third-party software that was
bundled with the systems.
Fourthly, all the systems are Java, open-sourced and retrieved from
sourceforge.org: they therefore cannot represent systems written in other
languages or using other developmental models.
These caveats notwithstanding, the data show that the configuration
efficiency of the sampled systems is low, that the systems do not display
evidence of optimised encapsulation.
The fundamentals of encapsulation theory suggest that the configuration
efficiency of entirely random systems tends to lie in the stable equilibrium
belt between 0.2 and 0.6 and that even a system with a high configuration
efficiency will degrade towards this belt as random updates are made. Yet none
of the systems sampled has a configuration efficiency above that of the stable
equilibrium belt.
To achieve a high configuration efficiency, a system must strike a balance
between the two, basic tenets of encapsulation (see, "Encapsulation theory in
39 seconds," in the, "Menu," link to the left):
- Minimise the number of public classes.
- Minimise the number of classes per package.
The configuration efficiency is a direct measure of both how many public
classes a system has and how many classes are in each package. In the
idealised case, a configuration efficiency of 1.0 implies that each package
has just one public class and all packages contain the same, ideal number of
classes; a configuration efficiency of 0.0 means that all classes are public
and thus all classes are potentially exposed to the changes of all others.
If widespread adherence to the above optimal balance were the norm then we
would expect many of the sampled systems to display high configuration
efficiencies, at least higher than 0.6 (the higher limit of the stable
equilibrium belt).
Puzzlingly, however, this is not the case.
It was found, in particular, that many of the systems contain a surprisingly
large number of public classes which are not used outside their packages,
contradicting (1) above.
For example, DW4J comprised 11827 classes, 4212 of which are public but not
depended upon by any other package: that's 35% of its classes. 38% of Java 2
XML Binding's classes are apparently unnecessarily public. 70% of VI Toolkit
for Java's classes are apparently unnecessarily public. It's possible that
some of these classes are accessed in ways unseen by the Fractality tool (for
example, the tool cannot analyse dependencies established through reflection),
but such large percentages seem unlikely to be caused by such unseen accesses.
We can also examine how configuration efficiency changes during system
development. If we take one system in particular, JBoss, figure 1 below shows
how the potential coupling of JBoss has increased during 9 releases between release 3 and
release 5, in which time its potential coupling rose from 80 million to 954 million.
Figure 1: The potential coupling of JBoss from release 3 to release 5.
Figure 2 shows the configuration efficiency of JBoss during 9 releases between
release 3 and release 5.
Figure 2: The configuration efficiency of JBoss from release 3 to release 5.
As can be seen from figure 2, the configuration efficiency of JBoss has not
risen significantly, suggesting that the encapsulation strategy being employed
by that project is maintaining the configuration efficiency at the lower bound
of the stable equilibrium belt, significantly below what might be achievable
through optimised encapsulation.
Given the general agreement on the benefits of encapsulation by the
programming community, it remains a mystery why none of the sampled systems
displays a configuration efficiency substantially higher than that of the
average of a sample of randomly encapsulated systems.
If the conjectures of encapsulation theory are borne out, then the potential coupling of
systems may be reduced - and thus the configuration efficiency of systems may
be increased - by optimising the number of public classes per
package and the number of classes per package.
That the isoledensal configuration efficiency of the open-source systems
analysed here seems so low suggests that either encapsulation theory is flawed
or that many open-source, Java systems are sub-optimally encapsulated.
The systems analysed in this survey were:
JavaOneOne, version 20050731: "Partially automate porting Java 2 code to Java
1.1 (for Mac Classic or the MS JVM) with jOneOne. Makes a copy of your Java 2
codebase, changing references from Java 2 objects to the Java Collections API
for Java 1.1 [and some other stuff]."
Java 2 XML Binding, version 1.1.0: "The J2XB project aims at offering seamless Java and XML integration defined in Java. J2XB is special in that no Java code generation is involved. J2XB transform the development of Java and XML binding from Java code generation to XML Schema generation."
Java DjVu Viewer, version 0.8.09: "Java DjVu provides an open source applet, and desktop viewer Java virtual machines. Versions of java supported include Microsoft Java, Sun Java 1.1 and later, and J2ME."
Java Assembling Language, version 0.10: "JASML is a java byte code compiler, providing yet another approach to view, write and edit java classes, even without the existence of a java source file - using the java macro instructions, those described in The Java Language Specification."
VI Toolkit for Java, version 0.1.2: "The VI Toolkit for Java is a Java library that is patterned after the VI Perl Toolkit. Administrators and developers who like the ability to quickly create scripts with the perl toolkit but appreciate the depth of Java will love the VI Toolkit for Java."
XML to Java Binding, version 1.3.3a: "XML to Java Compilation and Mapping. Compiles DTDs to Java class hierarchies and provides Java Object to XML binding. This is a two way binding. Very easy to use and very flexible. Does not require a "mapping" file or specification... Provides Java ob."
EJE (Everyone's Java Editor), version 2.7: "EJE is a simple Java editor, perfect to learn Java, without learning a complex development tool. EJE is multi-platform (written in Java), light- weight, user-friendly and have several useful basic features. A good help to start with Java!"
Jasmin - a Java assembler, version 2.3: "Jasmin is a Java Assembler. It takes ASCII descriptions for Java classes, written in a simple assembler-like syntax. It converts them into binary Java .class class files suitable for loading into a Java Virtual Machine implementation."
Prism for Java, version 0.1: "Better than EasyPHP, Prism for java is a framework that allows to run mutliple Java programs in a same Java Virtual Machine (or a dedicated one). You can also start non Java programs. Deploy its as preconfigured-plugins. Basics are : JBoss, Tomcat, MySQL."
Joj - Java Version of Java, version 0.1: "Joj provides a Java object representation of Java source code in a similar way that JDOM provides a Java representation of XML.
Members (1) "
DW4J Document Warehouse for Java, version 1.0: "DW4J :: Document Warehouse for Java, Content Management System developed in Java 5 language, uses Java Web Services Java. Client app in Java SWT and admin tools and image recovery in Web environment."
Java compiler & operators overloading, version August 17, 2007: "Jo2 (Java Operators Overloading) :: is Javac (Sun Java Compiler) extended by operators overloading. This open java project comes with a specification of operators overloading in Java. The resulting byte code obeys to the java standard specification."
Java Mozilla Html Parser, version 0.3.0: "MozillaParser is a Java Html parser based on mozilla's html parser. it acts as a bridge from java classes to Mozilla's classes and outputs a java Document object from a raw ( and dirty) HTML input."
Jdec: Java Decompiler, version 2.0: "jdec is a Java Decompiler. It can be used to reverse the bytecodes present in a .class File to produce a Java Source File which can be nearly correct or equivalent (Due To different Interpretations) to the original java file.[With UI & command line]."
JDBWC - Java JDBC via PHP, version 1.0.0.2_2: "Java-Data-Base-Web-Connector. JDBWC is a Java JDBC Driver designed for Java applications that require JDBC access across the internet, to database servers shielded behind a firewall. JDBWC uses JDBC via PHP to handle connections."
JNode: new Java Operating System, version 0.2.7: "JNode is a Java New Operating system Design Effort. JNode is a simple to use and install Java operating system for personal use on modern devices. Any java application runs on it, fast and safe. See our homepage for additional information."
Jeeves, version 1.1: "Jeeves is a java engine that simplifies development of web application. It uses xml as internal data representation and xsl to procude html output. It consists of the java engine, a java web server and a java IDE to build applications."
JBoss, version 5.0.0.CR: "The JBoss/Server is the leading Open Source, standards-compliant, J2EE based application server implemented in 100% Pure Java."
SmallSQL Database - Java DBMS, version 0.19: "SmallSQL is a 100% pure Java DBMS, a relational database for Java desktop applications. It has a JDBC 3.0 interface and offering many ANSI SQL 92 and ANSI SQL 99 features. It is very small and fast Java library. It does not have a network interface."
Java Clazz Utils, version 1.1: "Java Class files manipulation utility. Includes viewer of Java classes (with all JVM specific information) and Java decompiler."
OpenGL[tm] for Java[tm], version 2.8.0.8: "Project closed ! Please use JOGL. http://en.wikipedia.org/wiki/Java_OpenGL https://jogl.dev.java.net/ +++ OpenGL[tm] for Java[tm], formerly known as GL4Java, supports Java with a native OpenGL mapping. The OS native OpenGL functionality is avaiable from."
Extensible Java Profiler, version 2.2b1: "Extensible Java Profiler (EJP) is a profiling tool for Java with a scalable and extensible architecture, allowing its usage for exotic programming languages that use a Java backend."
CyberToolbox for Java, version 2.0: "CyberToolbox for Java is a VRML2.0/97 authoring tool for Java platforms. The CyberToolbox is a first prize winning entry in the Java 3D programming contest which was held on 1998 :-)."
jMechanic, version 0.6.0: "jMechanic is an Eclipse Java IDE plugin providing Java Profiling tools. Tools such as CPU Sampling and Heap Summary allow the Java developer to tune up the performance of their Java programs all within the comfort of the Eclipse IDE."
Java XML Mapping (JXM), version 0.4: "Java XML Mapping (JXM) is a tool for writing Java objects to XML and reading them back again. JXM provides a default mapping for objects that follow Java Bean naming conventions, and the default mapping can be customized programmatically."
JAud, version 0.8: "JAud is an Open Source Audio Application, using the JMF framework. Written in Java it utilises a number of Java libraries to try and create a Java application which does not look like or behave like a Java application."
Java Object Binding, version 0.3: "An API written entirly in Java for the binding of xml documents to Java objects. Unlike JAXB which binds the schema to the class, JOB uses a set of specifications to bind ordinary Java objects to ordinary xml documents. No schema compiler is involved."
Eclipse, version date 081102: "Eclipse IDE for Java Developers (85 MB)
The essential tools for any Java developer, including a Java IDE, a CVS client, XML Editor and Mylyn."
Spring (without dependencies), version 1.2.9: "The dominant application framework for Java, Spring solves core enterprise development and runtime problems, offering configuration via Dependency Injection; declarative services via AOP; and packaged enterprise services. Developed by SpringSource."
FitNesse, version 20080812: "FitNesse is a software development collaboration tool."
JINX, version 2: "JINX is a Java-based multi-user Unix-like environment that allows each user to remotely run their own java programs. Also the home of CurseHTTPD, a non-blocking java HTTP server."
Java Object Relation, version 0.1: "JOR is a Java Object Relation mapping tool that is very simple to use. It works with all mayor databases and requires only minimal coding effort. JOR strictly follows the POJO / POJI (Plain Old Java Objects / Plain Old Java Interfaces) model."
Abacus Java GUI Builder, version 1.8: "The AbaGUIBuilder is a visual GUI builder written in Java designed to look like the Delphi/VB designers. The Java GUI Builder was conceived to help the application developer design and create UI Java applications in a rapid manner."
PrEd, version 1.2: "PrEd is a Java based graphical utility to find and edit Java property files in JAR, WAR, EAR and other kind of ZIP archives. It is the perfect tool for customizing Java and J2EE application archives. Enjoy, Daniel Palomo van Es."
JPF, version 1.5.1: "JPF (Java Plugin Framework) is a general-purpose plug-in framework intended to help building scalable, extendable Java applications with low cost of maintenance. The framework is specially designed to be easily included into Java project of any kind."
pBeans, version 2.0.2: "Straightforward Java persistence layer. Provides automatic object/relational mapping (ORM) of Java objects to database tables. You just write Java code (no XML or SQL involved) and pBeans takes care of the database layer. It uses annotations."
Curl ORB for java, version 0.5: "Curl ORB is to comunicate between Curl and server side java. It can generate Curl source code from POJO which stands for Plain Old Java Object, and invoke the java methods on server side from Curl application."
JScript, version 1.1: "JScript is Java Interpreter that parse and execute pure java code and share the resource with current JVM. In addition, a java command line console is included. It's easy to create script program in Java grammar by it."
GlassFish, version Server v2 Update Release 2 (UR2): "Sun GlassFish Enterprise Server v3 Prelude is a commercially supported offering for GlassFish v3 Prelude, an open-source, lighweight Web 2.0 development and deployment platform. Sun GlassFish Enterprise Server v3 Prelude is ideal for deploying rich Internet applications backed by Java or dynamic languages such as JRuby."
Berkeley DB Java Edition, version 3.3.74: "Berkeley DB Java Edition is a high performance, transactional storage engine."
|