No, a "bean" is just a pattern that means that the object has getters and
setters for all of its properties. It can absolutely have other logic and
methods within it, and I would say it absolutely should. An object that is
nothing but properties along with corresponding getters and setters is
virtually useless. One might as well be using a regular structure. Make
those beans rich objects! :-)
On Thu, Jul 10, 2008 at 12:12 PM, Ronan Lucio <[EMAIL PROTECTED]> wrote:
> Brian,
>
> Brian Kotek escreveu:
>
> order = factory.create('Order', id);
> result = factory.create('Result');
> order.populate(data);
> // gateway will call order.validate() and if all is OK, call order.save()
> and set isSuccess to true.
> // if validation fails, the errors are set on the result object and
> returned
> gateway.save(order, result);
> if(result.isSuccess()) {
> result.setSuccessMessage('Order was saved successfully');
> }
> return result;
>
>
>>
>> Brian, I really liked your comments and your suggestions.
>> I'm just talking about how this suggest should be done/implemented.
>>
>> In one hand putting some logic inside beans looks a betters abstraction.
>> In the other hand it doesn't gives us a good encapsulation because it's
>> one more CFC to handle part of the business's rules.
>>
>
> I'm not sure I follow. What do you mean by "one more CFC to handle the
> business's rules"? Does what I'm showing above answer your question?
>
>
> Yes, it answers.
>
> In my readings about beans, DAOs, OO and etc I understood that beans should
> have only getters and setters.
> In Portuguese we could name it as "donkey object", they have no business
> logic inside.
>
> My doubt is if I put business logic inside beans I was breaking some OO
> concepts - turn beans in a richer (smarter?) objects.
> If you do this I suppose it's not breaking OO concepts or app
> maintainability.
>
> One more questions.
> "Telling the object what to do" can take much more operations into beans,
> right?
>
> example:
> client.activate() or deactivate();
> client.activateGoogleAnalytics( keycode );
> client.activateChatOnline();
>
> What do you think about that?
>
> Thanks,
> Ronan
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---