The first choice is the pinnacle of bad OO design, and is totally unnecessary in OO languages (it's what method overloading is for). The second choice is much better.
----- Original Message ----- From: Ian Skinner <[EMAIL PROTECTED]> Date: Thursday, September 11, 2003 3:36 pm Subject: Basic CFC method design question. > Generally which is better, a single method with branching logic > based on a > parameter, or separate methods? Or is there no really difference > and depends > on the personal choice and the situation. > > I am in the process of converting some procedural code onto cfc's. > I have > several queries that where written to serve multiple purposes > based on the > parameter passed to them. Basically something along these lines... > > <cfif form.new = true> > <cfquery ...> > INSERT INTO tableA > (Field1, Field, Field 3) > Values (A,B,C) > > </cfquery> > </cfif> > > <cfquery ...> > INSERT INTO tableB > (field1, field2, field3) > VALUES(D,E,F) > </cfquery> > > Basicaly if the insert is a new category add category date to the > category,if it is just a new data about an existing category added > it to the details > table. How might some of you more expienced OO types design this? > > -------------- > Ian Skinner > Web Programmer > BloodSource > www.BloodSource.org > Sacramento, CA > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Get the mailserver that powers this list at http://www.coolfusion.com