Up Late with MVC
Published 23 August 04 by Justin French
Whilst I already had a pretty good separation of data, logic and presentation in Bandography, things are now a lot better. In short, I’ve moved to a full-on MVC (Model View Controller) framework with a heap of libraries to help me add new modules to the application with relative ease. It’s a thing of beauty, and things will be moving along really fast now.
I could attempt my own bastardised explanation of MVC (and there are plenty of bastardised explanations, poor examples and confused concepts out there already), but I really like the Wikipedia entry.
The Rails 10 minute set-up video may also help those who’d love to see a great Ruby MVC framework in use.
There’s an article at PHP Patterns which (while flawed/confused in a few places) is still quite informative. More importantly, the comments at the end of the article offer more wisdom.
There’s also the Front Controller – a centralised controller (eg index.php) which acts as a mediator between the user request (e.g. ?section=music&action=display&id=12) and the required controller for that request (music). This could be considered a fourth layer in what I’m working on.
But wait, there’s more! In a web application, the View would be the HTML template. But since we’re all trying to separate HTML mark-up from the presentation (using CSS), I’d also consider Style Sheets (CSS) the new fifth layer.
And what does all this mean? It means that I can build rock solid Front Controllers, Controllers and Models for Bandography, and then let anyone who knows a little HTML and CSS contribute to the View and Style layers independently, without fear of them breaking the application.
Before you go…
Here’s some links to my most popular posts: