Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » J2EE Interest »

Re: DAO's factory is right or not! URGENT

Yagiz Erkan

2004-07-15

Replies:

> the Factory pattern I intorduced. So that there wod be less dependency
> between Beans & DAO's.

Less dependency: I'm not sure if you're achieving this. The
getBankOverrideDAO() method returns an instance of BankOverrideDAO class. In
terms of dependency, calling this method of the factory isn't different than
calling new() on BankOverrideDAO. In fact, it introduces one more class and one
more line in the client code, which has a negative effect. You could have had
the design/functionality by writing a singleton BankOverrideDAO class instead
of dedicating a factory to a single type (This doesn't apply if you're planning
to return more than one type from the factory in the given example). You can
have real decoupling by returning an interface type from the factory. Or by
using an abstract factory.

My two cents,

- Yagiz Erkan -
http://www.erkans.com

===========================================================================
To unsubscribe, send email to listserv@(protected)
of the message "signoff J2EE-INTEREST". For general help, send email to
listserv@(protected)".
©2008 junlu.com - Jax Systems, LLC, U.S.A.