so many questions!! :-) quick comments below

 Alan



________________________________
From: Henry <[email protected]>
To: CFCDev <[email protected]>
Sent: Wednesday, January 28, 2009 9:39:38 AM
Subject: [CFCDEV] Questions on Design of Bean, what is your version like?


- Do you generate setters & getters for each property, or use
onMissingMethod()?
AL: oMM()

- If you're using onMissingMethod(), does it look for cfproperties to
check for valid property name and type?
AL: no just looks for methods with get and set at the start and the number of 
passed args

- 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?
AL: oMM() will never be more efficient as cf has to do more work on each getter 
and setter call

- Are methods generally in bean, or in Service layer (singleton) for
better performance?
AL: I used to put them in Service, now as much as poss in the Bean - lets make 
our business objects / domain model more intelligent

- 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?
AL: yes and it used to return an arry of structs, now it returns a 
ValidationResult object so my view can have nice things like <cfif 
Result.hasErrorForField("username")> do this etc

- Does it always have some other standard methods?  Or does it extends
some abstract/base bean?
AL: extends a base bean. The base bean has common methods (like oMM()) but also 
composed/aggregated with an IBO and some utility objects


- Do you set default values for properties? if so, outside or inside
init()?  maybe make use of cfproperty default field?
AL: I treat init() as a constructor so do things inside init() ie set up 
variables.instance struct etc

- Does it lazy-load?  If so, how do you implement that?
AL: As John said 'it depends'. My OrderItem would probably be lazy-loaded if it 
getOrderItems() was called on the Order object but not if I asked for an 
OrderItem directly with a pk/id



      
--~--~---------~--~----~------------~-------~--~----~
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