nemetral.net | Insightful posts on design and code
The most interesting questions often arise after theory has been explained, when getting hands dirty trying to write some code, organize and design a software architecture or start compiling existing snippets into a comprehensive framework. Following my posts on MVC (see and digg the "A gentle introduction to MVC" series: Part 1, Part 2 and Part 3), a reader recently asked me a couple of questions related to common MVC implementation issues.
In part 1, we decoupled a vanilla PHP script and separated the business logic from the presentation. In part 2, we added a third element in the mix called the model and dedicated to the data access layer. It is now time to spice up the coding by introducing the role of Object-Oriented Programming in a MVC architecture and release the very basis (for educational purpose only) of a MVC framework.
In part 1, we saw how to decouple a traditional vanilla PHP script so as to separate business logic from presentation. This was the biggest step to make: from now on, we are just going to finetune this separation by adding a 3rd guy in the equation: the model. Ladies and gentlemen, this is part 2 of A gentle introduction to MVC.
MVC is certainly the widest spread architectural pattern in today's webdevelopment landscape. Brought back to fashion by Ruby on Rails from 2004 on, it has been translated and implemented into many languages and more than 100 web frameworks. This illustrated three-part is aimed at helping you cross the gap between a traditionnal vanilla PHP script and a full MVC implementation.
Nemetral is a freelance webdeveloper with 8+ years experience in the industry. On nemetral.net you will find insightful posts on design and code, tackling various topics related to webdevelopment from a highly educational perspective.
The very best of nemetral.net, as selected by readers.
Integrating design and code.
Exclusive articles written by nemetral, published elsewhere on the web.