Barry Beattie wrote:
sadly these particular CFC's are a mixture of data processing logic
and display. almost entirely  un-reusable (u kno wot I mean...).

on that point, what's wrong with the humble taglib custom tags
instead? if you do it right CF starts looking like a flex app with
MXML layout binding data to it with CF "scripting" to hook it all
together... if it were Java/JSP, would you bother generating great
sections of HTML within the java classes instead of leaving it to the
JSP to take care of?

I could go either way on the CFC/tag issue, depending on the specific case. In Java/JSP, no, I would mostly never write the HTML in a class (I may have some small bits in a UI class from time to time, but never more than a single tag or perhaps two). But, it is not for any other reason than writing HTML like the following is completely unreadable and impossible to follow, and more importantly easy to screw up:

String somehtml = "<html>";
somehtml += "<head><title>" + titleOfThisPage + "</title>";
somehtml += "<meta ...></head>";
...

Can you imagine doing an entire page like that? Or even just a table with more than a couple of columns? It's unwieldy. With CFC's however, you can still keep the HTML in its readable form. In some cases, I prefer to use CFCs to accomplish this goal, while in others, I prefer to use includes. I find myself preferring CFCs in particular, when cases arise where there may be slight customizations to a basic display, based on individual client preferences. I can inherit (or aggregate, if it makes more sense) from the base display (cut up into logical chunks) and reuse those parts which make sense, and only rewrite the custom bits. It lets me keep duplicate code to the absolute minimum - something I'm very fond of these days. The inheritance in particular has the extra benefit of allowing me to keep client code unchanged, as long as I've followed Liskov Substitution Principle.
but I digress. the lack of abstraction is just painful to (quickly)
follow and maintain the wreched thing...

I understand. I used to code like that, and now I get to maintain my own mess. =)

-Sam


You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]

Reply via email to