On Jan 7, 2011, at 2:43 PM, Henry Ho wrote:

> Yes, I get that, but with the DAO/Service/Bean approach, it seems like I have 
> more layers needed to be changed.  I'm just exploring if there're any other 
> lighter/more flexible approach to this.

I don't think there is anything wrong with having a DAO, Service and Bean, but 
there shouldn't be any real duplication of metadata between them. There should 
be a single authoritative source of any piece of data in your app. So you need 
to pick one place to tell your system what properties a given object has. 

IMO, if you need to edit more than one thing when you add a property to an 
object, you're doing it wrong. I always have a single place with metadata 
describing my objects (either putting it into the object and using 
instantiation and reflection or having a metadata bean that I load into all of 
the objects relating to a given business object) and use that to control data 
access, the object itself and anything in the service class that needs to know 
about the business object. Where I can, I also use that representation to 
generate my DB schema if I have one (or to generate migrations) so I'm keeping 
things nice and DRY.

Best Wishes,
Peter

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