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

-----Original Message-----
From: Rick Faircloth [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 22, 2008 10:39 AM
To: cf-talk
Subject: Re: How can this CFC be improved?

I think I'm beginning to understand your reasoning.
It's just taking some time for me to get to the "best practices" of CFC
usage.
Trying to get "anything" to work at first keeps my projects moving,
while beginning to employ different coding techniques.  I'm basically
trying to learn by writing code for projects that are going live with
these updates as soon as I can get them working...too busy for much
practice.

Also, I'm a solo developer and never plan to code while working for
anyone else..so as far as sharing code or compensation, it doesn't
matter.  My client's don't care, as long as the correct data shows up on
their pages.

But I am trying to figure out the best way to do all of this.

Thanks,

Rick

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:314258
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to