SQL Zone is brought to you in partnership with:

Daan is a software developer with a strong focus on interaction design. Mainly developing in Java. He likes Agile methodologies, and has worked many years with Scrum. Besides work, he absolutely loves experimenting with new (or old!) technology. Daan's blog can be found at http://stuq.nl. Daan has posted 8 posts at DZone. You can read more from them at their website. View Full User Profile

76 Events: Statistics About Hibernate 3.2.2

12.31.2008
| 7168 views |
  • submit to reddit
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 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!

Factories

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)

Hibernate 3.2.2 statistics Class Cloud

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!

From http://stuq.nl/weblog/

Here are all the articles in this series:

  1. 1942 classes: statistics about Spring 2.5
  2. 8.47% is a Resource: statistics about Wicket
  3. 37 Factories: statistics about Tomcat 6
  4. 76 Events: statistics about Hibernate 3.2.2
Published at DZone with permission of its author, Daan van Etten.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Johana Macedo replied on Wed, 2008/12/31 - 9:44am

Get outside more, please

Peter Karussell replied on Wed, 2008/12/31 - 1:46pm

funny stuff.

Daan van Etten replied on Wed, 2008/12/31 - 6:49pm in response to: Johana Macedo

[quote]Get outside more, please[/quote] LOL. You read my article, take the time to comment, and want me to go outside more? You should get a life. Seriously. Learn to separate serious stuff and fun stuff. Relax. Learn to dance, learn to live life as it comes to you. Keep in touch with your inner self and try to behave like a grown-up. Don't judge to soon, or you will be judged upon. Have a nice day, and a happy new year. - Daan

Arnav Desai replied on Fri, 2009/01/02 - 4:38pm

I dont believe catched is a word(I could be wrong). I know caught is and so is cached , never heard catched.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.