When you say bean.validate() -> calls service.validate(variables.somedata)
Can you clarify how the bean gets a reference the the service object? -Phil On 8/4/07, Sean Corfield <[EMAIL PROTECTED]> wrote: > > On 8/3/07, Alan Livie <[EMAIL PROTECTED]> wrote: > > OO is a tough subject to get to grips with and even after reading as > much as I can find on the subject I'm still at the crawling stage. > > Yup. And remember that there is no One True Way. For any given problem > there are multiple solutions - multiple design patterns may be > applicable and each design pattern may have multiple implementations. > > I personally prefer to have my business objects (beans) be smart > enough to think for themself - dumb beans just lead to procedural > code. That's not to say that a bean can't leverage a service object to > perform some common task but it's better to have a bean pass its own > data to some service than have the service ask the bean for the data. > > In other words: > > bean.validate() -> calls service.validate(variables.somedata) > > is better than: > > service.somemethod() -> calls bean.getSomeData(), then validates it, > then updates bean > > The latter is a very procedural approach - separating functionality from > data. > -- > Sean A Corfield -- (904) 302-SEAN > An Architect's View -- http://corfield.org/ > > "If you're not annoying somebody, you're not really alive." > -- Margaret Atwood > > > You are subscribed to cfcdev. To unsubscribe, please follow the instructions at http://www.cfczone.org/listserv.cfm CFCDev is supported by: Katapult Media, Inc. We are cool code geeks looking for fun projects to rock! www.katapultmedia.com An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
