Code reuse is always a good thing, but abstracting just for the sake
of abstracting usually isn't.  Like so many other design questions,
there isn't really a good general answer, the right choice will depend
on the specifics.

For large apps that you know will have multiple developers, have
sweeping changes in the future, etc. then the more encapsulated the
pieces are the better.  But for smaller apps with a single developer,
more abstraction doesn't help enormously, but it make for a longer
development cycle.  Just keep in mind that a lot of small apps grow
into large apps.

The one abstraction layer that I'd NEVER skimp on is what I'd call the
"service layer".  Whichever of the two ways you pick, your UI code
(that uses the CFC) should not be able to tell.  I.e. if you write it
with queries inline, and then later change it to use separate query
functions, you shouldn't have to change the UI code at all.  That,
without a doubt, is the most important place to have an airtight
abstraction layer in any application..

cheers,
barneyb

On 8/1/05, Phill B <[EMAIL PROTECTED]> wrote:
> I'm new to CFC's and need a little guidance from the more experienced.
> 
> Should I write a CFCs that has functions that contain logic and in
> return call functions that execute database queries?
> Or
> Should I write a CFC that has functions that do everything and doesn't
> reuse any database queries?
> 
> --
> Philthy
> www.labwrk.com
> www.myspace.com/labwrk/
> 

-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:213401
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to