I remember, way back in the day, building my first e-comm application 
for a client. I used an open source javascript cart called Nopcart. It 
was fairly easy to implement and adjust, and part of the beauty of it 
was the ability to place a small line of code [showCart()] on any page 
and it laid everything out for me. I included it's .js file in dozens of 
sites, dropped in my method where I need it, and there she was.

I am a firm believer in OO principals, separating the view from the 
logic and data manipulation, but there are times where it can and does 
make sense. Paul's suggestion is how I would handle it, use 
cfsavecontent and return the display as a string: i.e. 
myPollObj.showResults(). I personally would have these types of 
functions at the bottom of a CFC, grouped together, so that anytime you 
have to make adjustments they are always in the same place. Or, 
possibly, a collection of CFC's. Bean/DAO/Gateway objects, service 
layer, display layer type set up. Document your code well, scope your 
vars, and have fun with it. No one way is the right way, and every new 
challenge is a learning experience.

Steve "Cutter" Blades
Adobe Certified Professional
Advanced Macromedia ColdFusion MX 7 Developer
_____________________________
http://blog.cutterscrossing.com

Richard Cooper wrote:
> Hi all,
> 
> I've been using CFC's for a short while now and I'm really liking them. I can 
> really speed up developments now by reusing code. 
> 
> Thing is I know I'm not supposed to put any presentation stuff in them. But 
> say for example I had a poll cfc. I can run all of the actions through the 
> CFC fine, but why not add some optional basic html (i.e. form & results) so 
> that if wanted, the whole poll could be encapsulated within the one file and 
> in theory could be added to any site with just a couple of lines of code. If 
> the basic form & results didn't suit I could then go for a tailored option 
> for the sites that needed it but all would still be based on the one cfc. 
> 
> So would this a bad thing and why?
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2. 
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:271996
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