What’s Wrong With Java Part 2b

To give an idea why I needed 5KLoC for such a simple model, here is a detailed analysis of Keyword.java:

LoC Used by
43 Getters and setter
40 XML Import/Export
27 Model
27 equals()/hashCode()
21 Hibernate mapping with annotations
14 Imports
2 Logging
174 Total

As you can see, boiler plate code like getter/setters and equals() need 70LoC or 40% (48% if you add imports). Mapping the model to XML is more expensive than mapping it to a database. In the next installment, we’ll see that this can be reduced considerably.

Note: This is not a series of articles about flaws in Hibernate or the Java VM, this is about the Java language (ie. what you type into your IDE and then compile with javac).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: