There aren't any right or wrong answers, but here is what I tend to do, although I may change my mind next month!
> - Do you generate setters & getters for each property, or use onMissingMethod()? onMissingMethod() is my preferred, but if I'm in a large team, then I use getters and setters for auto generating good documentation. > - If you're using onMissingMethod(), does it look for cfproperties to check for valid property name and type? I do use cfproperty. Kevin Roche has a recent post on this: <http://www.objectiveaction.com/Kevin/index.cfm/2009/1/27/onMissingMethod-and-Abstract-Object--Part-2> http://www.objectiveaction.com/Kevin/index.cfm/2009/1/27/onMissingMethod-and-Abstract-Object--Part-2 > - 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? As Alan said. - Are methods generally in bean, or in Service layer (singleton) for better performance? Either depending on what I'm trying to do! I use Transfer decorators a lot so most of the logic is in the bean. Not sure about the performance gain/loss. > - Does the bean always stay in a valid state with restrictive setters? or do the setters and init() take in any type? AL: I let the bean be invalid and have a validate() method. Many disagree. I think validation on a setter is problematic because sometimes the valid state depends on several fields - ie a UK city in country USA. Some people now think a seperate Validator is a good idea. It probably is if done well. > - Does the bean have validate() function? Does it return an array of struct of {type, message}? or are you using any validation framework? Same as Alan. I like what Metro.riaforge.org does > - Does it always have some other standard methods? Or does it extends some abstract/base bean? I always try and use abstract beans (again I'm mostly talking about Transfer decorators here) > - Do you set default values for properties? if so, outside or inside init()? maybe make use of cfproperty default field? The init method in CF is the constructor, so set it in there. If it's a dependency then I use ColdSpring to handle that, with getters and setters. > - Does it lazy-load? If so, how do you implement that? It depends! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
