In a typical web application or any GUI based application,
MVC pattern is widely followed. MVC says there is a clear separation between
presentation layer, processing layer and the persistent layer. I always imagine
any private or MNC bank where there are front office people, Nice, beautiful
soft spoken who are the user interface. And in back office some ugly, tuff and
smart mangers who run the business.
Similarly we design our java application and I assume this
holds good for mostly in Object oriented paradigm. The presentation layer sends that data to
processing layer and it process as per business.
All the time data resides in objects. In Java and mostly
other object oriented language, Objects are very lively. They have attributes, behavior
and sometime emotions. They are also social as they follow life cycle , share a relations
etc. To save these lively objects in to
a dead hard disc or storage is called persistence. We can’t store live object directly to
storage or database. (May be some time in future ... this area is still under R&D ). We
have to break lively object to expression less
tuple ( a row in db table). Vice versa is also very much part of the
game like converting the tuple to active Object.
So in application programmer has to take care of these
breaking and making of object to store in to database. And this logic also
tightly coupled with different type of
databases. To improve the situation we
got OR mapping. Object Relation mapping
where an object which need to be persist hold the information about the
relation/table in database where it is
going to store. And a framework which
implement OR mapping responsible for serializing and de-serializing of objects.
Some popular examples of such OR implementing frameworks are
Hibernate, iBatis etc.
It reduces lots of effort and complexity of the programmer
to interact with database. And programmer can always concentrate on live
objects and Business.
No comments:
Post a Comment
Thanks.