Sounds like a good approach.

I'm about to duplicate much of the work I've done on a recent project
for another client and I plan to use CFC's instead of putting the
code into my .cfm's.  (I wouldn't call what I'm going to do "OOP"... :oP)

But since I've already written the code procedurally once, it should
be easier to see how to adapt it.

Rick

Dawson, Michael wrote:
> On a recent project, I built the entire codebase using linear code
> (non-OOP).  It was faster for me to see what data I actually needed that
> way.
>
> I considered this my prototype.
>
> Then, once I was satisfied with the project, I started to refactor my
> code.  I put all queries into a single CFC.  I put all paper receipt
> generation code into yet another CFC.
>
> That sure cut down on the amount of code in my main .cfm page
> (controller).
>
> However, I noticed a few other places that could be optimized.
>
> So, I created a service CFC that handled all interaction between the
> data CFC and the receipt CFC.  The only weird part is that some of the
> service CFC methods only call the database CFC methods.  In fact, I used
> the same method names in both CFCs.  I did this because I wanted my main
> ..cfm page to ONLY interact with the service CFC and not the database
> CFC.
>
> Finally, in my main .cfm page, I was left with only a cfswitch block.
> Each cfcase tag merely called on the service CFC to perform its tasks.
>
> This was great because I actually felt good about the code.  Also, I
> could fully-test each CFC and method, separately.
>
> Therefore, my approach was to build a low-tech prototype, then see where
> I could move specific logic from the main .cfm.
>
> It took a couple of iterations, but it works fine and it's easy enough
> to maintain.
>
> Mike
>
>   

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314266
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to