-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate, POJOs and the Don't Ask Prinziple
PostPosted: Fri Jul 30, 2004 10:30 pm 
Beginner
Beginner

Joined: Tue Mar 16, 2004 5:15 am
Posts: 33
Dear Hibernate experts,

I am facing a unnatural feeling of an emerging application currently consisting of 8 POJOs.

It seams to me that the POJOs end up to be state carrying objects. Lots of getters, lots of setters, no logic. The logic (model logic not business logic!) resides within a type called CoreModel.

After realizing that there is doublication of responsibility going on - POJOs know how to alter it's own state but CoreModel does so too. The question is how to solve it.

First approach: Melt down the POJOs to a bunch of getters / readable attributes and put all setter logic in CoreModel completely. Again this would render the POJOs to violate the Don't Ask Prinziple.

Second approach: Move all basic logic from CoreModel to POJOs. So let the POJOs know how to add its childs, create new childs and instances and do only let the complex model logic reside in CoreModel. This would add some more value to the POJOs and will solve the responsibility problem.

So the main question remains: Are there any advised cuts in responsibility between POJOs and the more complex model logic?


Bye,

Martin (Kersten)

PS: I used POJOs to refer to persistent classes/objects.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.