[thelist] How do I plan a dynamic site?

Hassan Schroeder hassan at webtuitive.com
Thu Jun 23 09:16:33 CDT 2005

Tim Burgan wrote:

> I'm wondering if someone can share some advice on how I go about 
> structuring server-side code that will drive a website (where each page 
> may be updated in a CMS-like fashion) in such a way that not only is the 
> site content easy to maintain, but the underlying code as well.

Think MVC -- Model/View/Controller:

(google for many more articles)

Just as modern page (markup) best practice stresses separation of
structure and styling, good application design separates the data
(content), presentation, and business logic for maintainability.

At the very simplest, avoid hideous things like:

   <% out.println("<h2>Mistakes</h2><p>"); %>
   <% out.println(ContentManager.getData('Mistakes') + "</p>");

:: instead, use something like:

   <h2><%= sectionTitle %></h2>
   <p> <%= sectionData %> </p>

:: where the values of 'sectionTitle' and 'sectionData' are set for
the request by the controller servlet (or equivalent).

Additionally, the 'sectionData' value may be set from a method like
but the implementation is flexible; getData() could be accessing a
file system, a DB, a Web service, anything -- and you can swap out
one data source for another by changing only that single method.

MVC is a design pattern, not a Java-only technology, but I think it
may be easier to implement in some languages than others. :-)

Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.

More information about the thelist mailing list