Writing Compliant Code with ColdFusion
TechnicalAnyone who's ever worked with me or for me will probably agree that I can be pretty seriously OCD when it comes to my code. I believe in standards, I believe in readability, I believe in maintainability. I'll spend more time than I probably should making sure that, once my code works, it's also pretty. Some have called it anal-retentive. They're right, but I'm sticking with OCD because it sounds better.
When I say that I believe in standards I mean web standards as well as code formatting standards. A post on cfsilence reminded me of how I have used ColdFusion to help produce compliant code.
In a previous life, I worked on a product that relied on a distributed content model. Output modules were pulled from all over the place and compiled into a single rendered page. Each of these modules were completely independent of each other except for the fact that they appeared together on the same page. This meant that none of the modules had their own head or body tags. Because most of this code dated back to 2000/01, the general response to a need for styles or scripts was to just drop an embedded style sheet in with the rest of the markup output.
The result was a rendered page with style and script tags scattered throughout the markup code. Ugly, at best. Ugly and non-compliant at worst. But then a buddy at Adobe reminded me of the cfhtmlhead tag. Doh! How had I managed to so completely forget about that one?
Coupled with cfsavecontent, I managed to rid myself of one standards-related problem very quickly indeed:
It still wasn't as pretty as I'd like, but at least all of the module-specific styles and scripts were consolidated and located within the head tags. That's progress...right?






Loading....