DAO use

what is the use of DAO classes in web based applications
[63 byte] By [shravan603a] at [2007-11-26 17:07:31]
# 1
> what is the use of DAO classes in web based> applicationsWeb applications need databases too.What do you mean by "what is the use"?
zadoka at 2007-7-8 23:35:21 > top of Java-index,Java Essentials,Java Programming...
# 2
It's just a facade layer so your web app isn't tied to any specific database access code. You don't have to do it, but almost everyone uses it (or some type of ORM solution)
CarrieHunta at 2007-7-8 23:35:21 > top of Java-index,Java Essentials,Java Programming...
# 3

> what is the use of DAO classes in web based

> applications

Here's my take on it - DAO or Data Access Object is basically a class that acts as an itemidiary between 2 different parts of a program. This way neither side has to worry about who they are dealing with. Think of a mortgage broker as a DAO. They worry about the specific interface that a particular bank will require, where as you the user can submit the same information even if you switch banks.

( For some reason I always have a hard time grasping direct logical thoughts, but much easier when they are presented with an analogy).

would any of the more experienced individuals here care to correct any errors in my analogy ?

Aknibbsa at 2007-7-8 23:35:21 > top of Java-index,Java Essentials,Java Programming...
# 4
As carrie said, it's primarily to decouple your code application code from any specific database implementation/driver/etc.,
cjmosea at 2007-7-8 23:35:21 > top of Java-index,Java Essentials,Java Programming...
# 5

> > what is the use of DAO classes in web based

> > applications

> Here's my take on it - DAO or Data Access Object is

> basically a class that acts as an itemidiary between

> 2 different parts of a program. This way neither

> side has to worry about who they are dealing with.

> Think of a mortgage broker as a DAO. They worry

> about the specific interface that a particular bank

> will require, where as you the user can submit the

> same information even if you switch banks.

>

> ( For some reason I always have a hard time grasping

> direct logical thoughts, but much easier when they

> are presented with an analogy).

>

> would any of the more experienced individuals here

> care to correct any errors in my analogy ?

*Note that should say intermidiary not itemidiary.

Aknibbsa at 2007-7-8 23:35:21 > top of Java-index,Java Essentials,Java Programming...
# 6
> *Note that should say intermidiary not itemidiary.Yup. "intermidiary" is certainly easier to understand than "itemidiary". But "intermediary" would be even better.:)
DrClapa at 2007-7-8 23:35:21 > top of Java-index,Java Essentials,Java Programming...
# 7

> > *Note that should say intermidiary not itemidiary.

>

> Yup. "intermidiary" is certainly easier to understand

> than "itemidiary". But "intermediary" would be even

> better.

>

> :)

Can I refer you to the TGIF thread ;-) I can't wait to get out of here and climb into a bed and sleep for about 18 hours.

*Edit*

Ps. Does the analogy hold farily well ?

Aknibbsa at 2007-7-8 23:35:21 > top of Java-index,Java Essentials,Java Programming...
# 8

> > what is the use of DAO classes in web based

> > applications

> Here's my take on it - DAO or Data Access Object is

> basically a class that acts as an itemidiary between

> 2 different parts of a program. This way neither

> side has to worry about who they are dealing with.

> Think of a mortgage broker as a DAO. They worry

> about the specific interface that a particular bank

> will require, where as you the user can submit the

> same information even if you switch banks.

WTF?

> ( For some reason I always have a hard time grasping

> direct logical thoughts, but much easier when they

> are presented with an analogy).

So we see.

> would any of the more experienced individuals here

> care to correct any errors in my analogy ?

I think you're describing a Facade. DAO has to do with - wait for it - data access from a data source.

How can you describe what a DAO does without once using the word "data"?

%

duffymoa at 2007-7-8 23:35:21 > top of Java-index,Java Essentials,Java Programming...