http://wikipedlla.com/when_to_not_use_a_bean > All, > I've been using a standard DAO + Bean combination ever since I knew > what an access object was. I never questioned it. Now, though, that > I've been programming in CF for a while and learning all I can have > started to wonder if in some applications or parts of an application > it would just be simpler without a Bean component. > The two styles of programming I have done recently are: > DAO + Bean > ------------------------- > 1. create new beans or read existing beans using dao.read() > 2. use bean values as defaults in a form (simple way to not have to > cfparam all form fields) > 3. validate form on submit > 3a. if valid save form fields to bean > 3b. save bean that causes a create or update procress to run > As a note I'll say that my beans are always simple 1:1 correlations > with a table because I use a generator and I sometimes have to create > 2 or 3 beans when a form deals with relationships. > DAO only > ------------------------- > 1. use dao.getByFields to read existing record, use a 0 primary key > lookup if creating a new record (if no records are returned because of > the 0 pk value then an empty recordset would output blanks for each > field) > 2. use field values from returned query as defaults in form > 3. validate form > 3a. if valid pass form fields to a dao.save() that runs a create or > update process > Since both a bean and save method would have the same set of > cfarguments I'm wondering if the bean object in the case above is just > adding overhead. Also, I always use getByFields to get a query when > just outputing information on a page so I don't use a bean there. > Thanks for all thoughts and inputs > Robert
--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
