This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Master DAO or many DAOs ?

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
In my application, I have domain objects like : Book, Author, Publisher (I'm using Hibernate)....
I created interfaces like BookDAO, AuthorDAO and then implement them using HibernateDaoSupport.
But while I'm coding my DAO's, a question came into my mind :
Is it good to many DAOs (like my case) or to create a master DAO called for example :
BookStoreDAO ?
What is the right approach here ?
Thanks folks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
There is no right or wrong here. It's a matter of personal preference.
 
Jaime M. Tovar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recomend many daos if you are planning to reuse your code. You can just take the things you need and leave everything else out of your new project. It is also easier to work when you are doing maintenance because you know exactly in which dao you need to do the corrections.
Well just my opinion.
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have both many daos and then a master dao that most others are obtained from. but that master dao is not really a dao then since its not really about data access but dao access
 
Pavel Kubal
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to add, that there's no wrong and right. There is better and worse (or equal :-) ). And it really depens on what is the target scope.

But from you description, I incline to many DAOs.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic