I always get excited when I see another person questioning the use of frameworks that ask you to either replace one language with another or write additional code as a life support to sustain the framework’s functioning. This time my kudos to Christin Gorman, who did a great job explaining why using the Hibernate framework over SQL is a bad choice. Watch this video , where Christin uses the Cake Mix metaphor to deliver her message loud and clear.
In the past I was using a different metaphors. One was about the goat and rabbi. The other one is about the Axe Soup a.k.a. Stone Soup. I remember this story about a soldier returning back from war. He was very hungry, and, when reached some village, he asked a women living there to give him some food. She rejected. Then he asked for a pot of water so he could cook a soup form his axe. She became curious and agreed. After placing the axe in a boiling water he asked if she had just one small potato to add some flavor to the Axe Soup. She gave the potato. Than he asked the woman about a small onion, and on and on and on. When the soup was ready, he removed the axe from the pot and fed himself with a tasteful soup.
This is pretty much the situation in many enterprise IT shops that blindly prefer using frameworks to the programming language itself. If you didn’t get the analogy, Hibernate ORM framework is an axe. Add it to the project (the pot), then write some HQL queries, which is a replacement of SQL, learn and use a couple of dozen annotations, and after all this is done you won’t need to worry about JDBC.
Well, you may need to fine tune the HQL, but it’s later…But now we are covered. We are hibernating as everyone else, yay! If something will ever go wrong, we can always remove Hibernate from our code, right? Sure, the same way as the soldier pooled out the axe from the soup, when his project was complete.
I really like many improvements that made Java EE 6 light , easy, and really helpful. I like the concept of pruning, which means gradually getting rid of the useless JSRs. But if you ask me, I’d pruned JPA 2.0 without thinking twice. The goal of this 500-page spec is to replace SQL with another language. Why? I don’t know.
Cristin is right, professional chefs never use cake mixes. But, unfortunately, the modern IT shops are more like the fast food chains than Michelin restaurants.