76 Events: Statistics About Hibernate 3.2.2
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.
What is Hibernate?
Hibernate is a free, open source Java package that makes it easy to work with relational databases. Hibernate makes it seem as if your database contains plain Java objects like you use every day, without having to worry about how to get them out of (or back into) mysterious database tables.
Hibernate listens very carefully
What immediately catched my eye was the amount of classes with Event (76) or Listener (52) in their name. There are many events in Hibernate which can be catched. These events can have some related classes, like:
- the event itself (for example the AutoFlushEvent)
- an interface (the AutoFlushEventListener)
- a default implementation (the DefaultAutoFlushEventListener)
It almost surprised me there was no AbstractAutoFlushEventListener or a AbstractAutoFlushEventListenerFactory!
There are 57 factories, which is quite a lot outside of an industrial park. A lot of stuff can be created using factories, for example the BasicProxyFactory, the CGLIBProxyFactory, the CacheFactory, the ClassicQueryTranslatorFactory and the MapProxyFactory. I would guess this is the most popular design pattern within the Java world. Factories are everywhere.
Types and Collections
Luckily, there is also a lot of stuff directly related to the goal of Hibernate. There are 85 classes with Type in their name, and 54 have something to do with a Collection.
There are basic types like the FloatType and IntegerType. Advanced types like the OrderedMapType and the OrderedSetType. PersistentCollection and BasicCollectionLoader. These class names look quite good!
Class Cloud (click to enlarge)
Top 10 of partial class names
- Type: 85
- Event: 76
- Factory: 57
- Collection: 54
- Cache: 53
- Exception: 53
- Query: 53
- Listener: 52
- Entity: 47
- SQL: 39
Longest class name
The longest class name of Hibernate is the CollectionFilterKeyParameterSpecification, with 41 characters!
The API documentation describes this class:
A specialized ParameterSpecification impl for dealing with a collection-key as part of a collection filter compilation.
I thought API documentation was meant to clarify? At least the above contains some pointers (like the ParameterSpecification).
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!
Here are all the articles in this series: