Need some clarification with Patterns (DAO x Gateway)

Posted by Marcos Placona on Stack Overflow See other posts from Stack Overflow or by Marcos Placona
Published on 2010-05-11T10:54:46Z Indexed on 2010/06/10 11:42 UTC
Read the original article Hit count: 252

Filed under:
|

Me and my colleagues got into this discussion early this morning, and our opinions started to clash a bit, so I decided to get some impartial advice here.

One of my colleagues reckons that the DAO should return an object (populated bean). I think it's completely fine when you're returning a recordset with only one line, but think it's overkill if you have to return 10 lines, and create 10 separate objects.

I on the other see that the difference between DAO and Gateway pattern is that the gateway pattern will allow you to return a recordset to your business class, which will therefore deal with the recordset data and do whatever it needs to do.

My questions here are:

  1. Which assumptions are correct?
  2. What should the return type be for a DAO (i.e. getContact() - for one record)
  3. Should getContacts() (for multiple records) even be on the DAO, if so, what's it's returntype?

We seem to be having some sort of confusion about DAO and Gateway Patterns. Should they be used together?

Thanks in advance

© Stack Overflow or respective owner

Related posts about subjective

Related posts about design-patterns