On Sat, Apr 3, 2010 at 6:46 PM, C. Hatton Humphrey <[email protected]> wrote:
> One of the biggest factors I use to decide to SP or not is code
> re-use.  I'm working on an app right now where the same complex
> procedure is used on 4 pages and 3 reports... so moving things to a SP
> makes sense there.

Or put the code in a utility object. I'm not against SPs when they are
honestly appropriate but I fundamentally am against housing model
logic in two largely incompatible places. I used to put a lot more
logic in the DB and then became convinced that a DB isn't a place for
logic, it is a persistence mechanism.  There used to be apps where the
logic was totally in the db, like in the days of PowerBuilder systems.
And that makes sense. But if you have an application, I think that the
logic for the app should be all in an area that is easily accessible
to the application. If it is a CFML app, then the logic should be in
CFML. Hiding parts of the app down in another system, like a DB, may
be occasionally necessary due to resource constraints but it is never
a good design decision.

Code reuse in CFML is easy. Take advantage of it. There are situations
where db constructs makes sense...I have a view that runs a large part
of one of my production systems. But a view, generally speaking,
doesn't hide as much logic as a stored procedure does, or at least
can. And if the SP doesn't hide much logic, then it doesn't serve much
purpose. And if it does hide a lot of logic, then it honestly belongs
in your model where the rest of your logic resides. Obfuscating
selective logic is bad.

Cheers,
Juda

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:314955
Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-community/unsubscribe.cfm

Reply via email to