@Brian, you said 'I do and have it return a Result object.' Can I be nosey and ask what public methods are in your Result object? :-)
I have things like Result.hasErrors(), Result.getErrorForField(), Result.hasErrorForField(), Result.addError() etc Always looking for improvements! Alan ________________________________ From: Brian Kotek <[email protected]> To: [email protected] Sent: Wednesday, January 28, 2009 12:24:00 PM Subject: [CFCDEV] Re: Questions on Design of Bean, what is your version like? On Wed, Jan 28, 2009 at 4:39 AM, Henry <[email protected]> wrote: - Do you generate setters & getters for each property, or use onMissingMethod()? Use Transfer, which does all this for you. But if you don't, generate them so you have an actual API. - If you're using onMissingMethod(), does it look for cfproperties to check for valid property name and type? See above. - Do you think a complex bean with lots of properties will be more efficient with onMissingMethod() or with good old getters & setters for each property? No, using oMM() will always be less efficient. - Are methods generally in bean, or in Service layer (singleton) for better performance? It depends on the method. Don't think about performance. If it is related to the behavior of the domain object, put it there. If it is related to orchestrating interaction with multiple domain objects or other services, put it in the service. That said, the service should be as dumb as possible. - Does the bean always stay in a valid state with restrictive setters? or do the setters and init() take in any type? That's up to you. - Does the bean have validate() function? Does it return an array of struct of {type, message}? or are you using any validation framework? I do and have it return a Result object. - Does it always have some other standard methods? Or does it extends some abstract/base bean? Most often it extends an abstract bean or an abstract Transfer decorator. - Do you set default values for properties? if so, outside or inside init()? maybe make use of cfproperty default field? I only use cfproperty for Value Objects that are meant for something like Flex, and in that case I generate the VO and specify default values if necessary. - Does it lazy-load? If so, how do you implement that? Transfer will do this if you want it to. Implementing it yourself will be non-trivial. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
