Chapter 13: Model, View, Controller (MVC)


When PHP first arrived on the scene, a minor revolution took place. Interactive Web applications, once the preserve of the development professional, were springing up left, right, and center. Suddenly, some seemingly sophisticated interactive Web content, which went well beyond the traditional guest book CGI script, was appearing in some very surprising places.

The reason for this revolution was the enormous accessibility of PHP. It's not just that the "hello world'' program was refreshingly easy to implement. Even traditionally complex procedures such as database integration became possible with just a few lines of code.

The problem, however, is that this accessibility was quickly abused. In some cases, it resulted in complex applications' being built by inexperienced development staff. In others, previously dedicated professionals understandably let their traditional values lapse slightly in the face of enormous temptation to take advantage of the simplicity PHP offered.

The risk associated with such development is obvious. Such abuse has led to unmaintainable applications on a shocking scale along with well-documented cases of instability, unreliability, and even exploitable security holes.

Although many programming languages such as Java and C++ enforce good programming practices through their design, PHP requires self-discipline. The difference between a seasoned PHP professional and a bedroom coder is exactly that self-discipline. One of the most notable examples of such best-practice methodology is that of the model, view, controller (MVC) pattern.

In this chapter, you'll learn what MVC is all about and why it's a great methodology to use in your own programming. You'll build up a useful toolkit for handling some core parts of the MVC principles and learn how to use them in your applications.

Finally, you'll be introduced to two effective ways to implement the use of templates in your application and how to use templates alongside the MVC toolkit you've just met.

Professional PHP5 (Programmer to Programmer Series)
Professional PHP5 (Programmer to Programmer Series)
Year: 2003
Pages: 182
BUY ON AMAZON © 2008-2017.
If you may any questions please contact us: