Are DAOs part of the business layer?

Hi,are DAOs part of the business layer? I have to write some stuff for school and have to assign the classes involved in my project.CheersJonny
[171 byte] By [jonnybeckera] at [2007-10-1 23:57:33]
# 1

> Hi,

>

> are DAOs part of the business layer? I have to write

> some stuff for school and have to assign the classes

> involved in my project.

>

> Cheers

> Jonny

DAO is not supposed to be a business layer; however, many DAO patterns are badly implemented, people end up modifying the DAOs when the business requirements change.

jonnybeckera at 2007-7-15 15:50:08 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
Hi,thanks for the answer. > DAO is not supposed to be a business layer;Be a business layer? Or be PART of a business layer?If you meant "be part of a business layer":Which layer do the DAOs belong then?CheersJonny
jonnybeckera at 2007-7-15 15:50:08 > top of Java-index,Other Topics,Patterns & OO Design...
# 3
Daffy is not a good person to listen to. The best I can say is that he probably means well.DAOs are part of your Data layer, though they are certainly likely to be used by your Business layer.
dcmintera at 2007-7-15 15:50:08 > top of Java-index,Other Topics,Patterns & OO Design...
# 4

To expand on that, if your business layer changes to include new requirements, it is perfectly likely that your data layer will need to change to accommodate them -there's nothing wrong with that.

Daffy seems to have it almost exactly the wrong way around (no surprise there); the job of the data layer is to protect your business layer from changes to the underlying data sink(s). It should be possible to swap Oracle for Sybase, or databases for flat files, and this will remain hidden behind your data layer. The business layer won't have to change to allow for that.

It is not the job of the data layer to anticipate every possible demand that the business layer will ever make of it. Just provide the minimum that's necessary to support your existing business layer, and enhance it as and when such a requirement arises.

Dave.

dcmintera at 2007-7-15 15:50:08 > top of Java-index,Other Topics,Patterns & OO Design...