Architecting Your Views Part 2: Examining the Alternatives
There are two main approaches to rendering views: script based concatenation and view based templates.
Everybody Loves ColdFusion
One of the great things about ColdFusion was that before object zealots like me started shooting their mouths off, it was really easy to learn :-> Just stick some variables and maybe the occasional query and cfoutput into your display templates and you’re done! A templating based approach has two major benefits. It is easy to learn which makes it ideal for pages that designers might have to edit, and it is efficient and easy to visualize, making it one of the most productive approaches for most developers irrespective of their skill level.
But anyone who’s written a table with dynamic page links based on a recordset has come across the limitations of putting all of that code into their layouts (especially if they then asked a graphic designer to make some other changes to the page and came back to find a ColdFusion error and some mangled code!).
Concatenation can be Cool
While creating an entire page using concatenation of an HTML string is a painful process, for creating a list of paging links for a table or anything else requiring a lot of code and a little markup, it can be ideal.
Bringing them Together
The ideal approach is a template based solution with the ability to easily call some view helper cfc’s to take care of rendering anything a little more complex. In practice I am finding that a render object for orchestrating the process, extensible parameterizable UI components and reusable layouts provide the ideal blend of capabilities and syntax to create views meeting my design goals.


There are no comments for this entry.
[Add Comment]