Saturday, December 8, 2007

Hibernate (ORM) Debate - Good or bad

There are people those who hate ORM based application. Of course there are reasons for it. Personally I like ORM - again of course for some good reasons. Mostly, the people who dislike ORM, blame it for its performance. Of course there are some performance issues while using ORM - largely due to the paradigm-rift between the two worlds - object oriented and relational. But this issue can be solved - can be solved almost (if not all) entirely. The question now is how easy to solve this problem. We will see this soon in this post. When we talk about its advantages and disadvantages we tend to forget the intention of the ORM tool. To get the benefit - it is to be used in the right context where it is intended to be used. Lets see the right context. Relational technology is good for database i.e. information store, retrieval and management. Over time relational technologies got maturity and stability and most importantly it has become standard and created industry wide standards like SQL. Simply, for database - relational technology is the best - so far. For data centric application - most of the times there is a need for data model and the data model can be well developed with the relational paradigm in mind. I.e. laying out tables and their relationships. There is another important thing - i.e. Objects. Why it is required? Real world better understands objects such as a pen, a chair something that exists in the real world. To deal with real world objects we need domain model or may be in general an object model - rather I would say - it is better to use domain/object model while dealing with real world objects. Now we have two things - one is data model and other is object/domain model - two different paradigms - two facets of application development - and both are important. We need to take care of both of the facets in the direction of their implicit requirements.

Hibernate - or a good ORM tool - sits in between these two paradigms in order to connect the best of both worlds - the object world and the relational world - meant to solve two distinctive but related faces of real life applications - object oriented technologies and relational database technologies.

The major advantage of using Hibernate like ORM is to let application developers to think about business objects and largely automates the database related stuffs.

No comments: