• Post Reply Bookmark Topic Watch Topic
  • New Topic

Interfaces  RSS feed

 
Sahil Sharma
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why to use Interface for service and DAO classes. Why can't we simply create normal DAO classes instead of creating an interface and then implementing the same as required DAO class.
 
karthikeyan Chockalingam
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this interview with Erich Gamma

http://www.artima.com/lejava/articles/designprinciples.html
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happens if the source of data changes in future , then you have to refractor all the classes that used your DAO.If you write your DAO's sticking to an interface then only implementing the interface to support the new data source should be enough to make it work.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!