|
Posted by Frank van Wensveen on 01/23/07 14:28
Friend, coders, fellow wage slaves, lend my your ears.
I believe that in a perfect world the design of a website (or feature
on a website) should be totally separated from its design and the data
it serves up. I'd like some suggestions on good ways to do this,
because in the real world it can be quite difficult.
For example, if I'm rummaging around in a MySQL database, the table
structure and the code that generates the SQL requests are often
interrelated. Restructure your table(s) and you have to update your
code accordingly.
Another, more serious issue is the separation of design from code. For
example, if I'm using tables to divide my pages into separate 'blocks'
(e.g. for a top bar, menu, content section, side bar, banner space,
etc.) then the structure of these tables and table cells are
interrelated with the program's flow: you set up a table or table
cell, do something that outputs data into that cell, close the cell
and/or table, and move on to the next cell to do something else there.
Removing or adding a cell will mean that the function(s) that output
data into that cell should or should not be called. Or the order in
which code is executed could be affected: if I want a page-wide top
bar cell followed by a menu column and a content window underneath, I
need to render the top bar table row first, spanning two columns, then
start a new table row in which I'd put the menu and content cell. But
if I want a menu bar all the way to the top of the screen and a top
bar cell followed by a content cell both to the right hand side of the
menu column, I need to render the menu cell first, spanning two rows,
and then progress to rendering the top bar and content cells.
One could of course take abstraction and modularization to extreme
levels (e.g. put every line of table-related code into a separate
template file and include that depending on program flow) but this
quickly increased both complexity and overhead to beyond what is
acceptable. Not to mention the fact that ideally one should not issue
function calls from within a content template file.
So how do real developers do this?
Regards,
Frank
Navigation:
[Reply to this message]
|