Frameworks are growing with every release. Classes are changed, removed and added. In this series I zoom in on some well known projects and analyze their class names with completely meaningless statistics. This is the analysis of Tomcat 6.
To get these statistics, I wrote a script that analyzed all classes. They get chopped up on word boundaries, so for ContextAwareFactoryBean the words Context, Aware, Factory and Bean are counted. From the output I generated a Class Cloud.
Tomcat is definitely Context-aware
Tomcat consists of 956 classes. Of those, 55 classes contain the word Context, a percentage of 5.75%. Remember that every live object has its own ‘context’, and the word instantly loses a lot of meaning. The API documentation gives some clearance about the subject:
A Context is a Container that represents a servlet context, and therefore an individual web application, in the Catalina servlet engine.
Every self-respecting framework has factories. It nicely keeps the newcomers out and makes it ‘easier’ for the experts. Well, Tomcat has 37 of them. Just like Spring, Tomcat has a BeanFactory. The API documentation say just enough to leave me in confusion:
BeanFactory: Object factory for any Resource conforming to the JavaBean spec.
It was love on first sight with the AbstractObjectCreationFactory. It all comes together in this single class. Every project should have this… until now you created all your abstract objects yourself, this is not needed anymore! All those years!
Unfortunately, I had it wrong. This is an abstract implementation of the ObjectCreationFactory interface. Further investigation revealed that this is part of the Digester package.
The Digester package provides for rules-based processing of arbitrary XML documents.
I have no idea why this is in Tomcat. A leftover? Bad refactoring? Who knows?
Class Cloud (click to enlarge)
Top 10 of partial class names
- Context: 55
- Factory: 37
- Task: 33
- Ast: 33
- Channel: 33
- Rule: 32
- Base: 31
- Constants: 30
- Handler: 30
- Jsp: 27
Longest class name
The grand prize goes to: MbeansDescriptorsIntrospectionSource, with 36 characters!
The API documentation does not contain a description of this class, so I have no idea what it does…
Stay tuned for more useless statistics for other well known projects! If you have suggestions for which projects you want to see, please let me know in the comments!