On 11/15/05, Nando <[EMAIL PROTECTED]> wrote: > Would you call it a Factory if it *contains* stateless instantiated objects > (in application scope) and makes them available to the rest of the > application, but didn't actually instantiate them? Or a Service? I was > thinking that's a Service, hence i called it a DaoService, because it merely > contains the instantiated objects and exposes them to the rest of the app to > use.
Well, you're talking about an implementation detail. The factory is still how the rest of the app gets the DAO objects. If the factory is managing singletons, it has to store an instantiated object somewhere so that it can return the same reference to it for every request. So it's still a factory. > I could design the Factory (the Factory being a singleton in application > scope) to instantiate the DAO's into it's own variables scope, rather than > returning them directly, and let the rest of the app access them via > getters. But then the cohesiveness of the Factory breaks down and it's less > reusable. I don't think I agree. You have a factory object. You ask it for a DAO. You get back the (singleton) DAO. It's doing one job (managing creation of other objects) and doing it well. That's pretty much the definition of cohesion. > So i'd rather pass Factory into > Dao[Service?Manager?Component?WhoAmI?] so that Factory can do it's > specialized thing and the Dao[Service?Manager?Component?WhoAmI?] can just do > its specialized thing. And what is the "specialized thing" that the DAOWhatever does? That "specialized thing" may tell us what the "Whatever" part actually is... -- Sean A Corfield -- http://corfield.org/ Got frameworks? "If you're not annoying somebody, you're not really alive." -- Margaret Atwood ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
