or, how I learned to stop worrying and love the XMLHTTPRequest…
This is the first part of what will become an ongoing series.
If you’ve built a website in the last few years, most likely you’ve adopted an architecture similar to Model-View-Controller, or MVC. If not, well, either your website is terribly simple, you haven’t had to modify it yet, or your code is spaghetti and you should be fired. Just kidding. (Or maybe you’ve come up with an even better architecture, in which case you should share your insights with us mere mortals.)
This separation is nice because changes to the database engine or relational structure are isolated from the output generation, and adding new output formats for the same data or radically modifying existing output generation is similarly isolated from the database queries. Although controllers sometimes simply pass database results through to a view, the controller stage is important because there is very often idiosyncratic processing that has to happen between user input and database access, and between results from the database and output generation.
With an architecture like this, you might as well go back to the good old days when web apps mixed SQL generation, SQL queries, and HTML fragment generation in a single function. Yee-haw!
Separating CSS into layout/spacing CSS, and color/background CSS makes it easy to allow users to choose, or make their own color themes without royally screwing up layout.
Unfortunately, CSS is still woefully inadequate for this job, but it’s nice to dream, isn’t it?