On Thu, Jul 10, 2008 at 7:32 AM, Brian Kotek <[EMAIL PROTECTED]> wrote:
>> In the first example we're saying "Hey, take this form and populate
>> yourself with these values".
>
> Yes I would say that it is. There's no reason ask another object (the
> OrderService) to populate the Order object when you can just tell the Order
> object to populate itself.

Just to clarify, since I think I was the one advocating using a
service here (I've certainly advocated it in discussions with folks
this last week or so)...

If the populate() method is generic - it iterates over the collection
and calls matching setters - then it is not specific to a bean and
rather than have an artificial base class to contain such common code
(inheritance should not generally be used for sharing implementation
details), it is easier to put that common non-type-specific code in a
service. One copy of the code.

Mach-II and Model-Glue take this approach by making such a method
available as part of the framework since it's a common task.

Also, since this operation tends to happen when populating beans from
forms primarily, it feels "wrong" to me to have this in a bean - I'd
be more comfortable with it being in the controller layer somewhere
(again, as Mach-II and Model-Glue have it).

Of course, there's no black and white "right" or "wrong" ways here and
there are tradeoffs in both approaches.
-- 
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 received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to