MVC and PHP

Translation of the original in Catalan. Read it in: CatalàCastellano

As many of you know I am not a computer scientist nor do I pretend to be, but as I always say, those of us in telematics are presumed to know computing. Some say that knowing how to program is not knowing computing but I think that at least if you know how to program you know a bit of computing. So, among all this dilemma I have built up just to say that, until not many years ago I had not heard about the MVC programming system (Model Business, View and Controller). Maybe someone remembers that a long time ago I published an article where I recommended the website of Tony Marston. Well, that was where for the first time I got to know this whole subject somewhat in depth.

Even though I don't need it for anything in particular, a few days ago I thought it would be a good idea to go a little deeper into this MVC subject and I have been reading a little about it. Since the programming language I use most is PHP I looked for information about frameWorks that implemented the MVC model on this language which in principle does not implement an MVC structure by default. To give you an idea, in ASP applications (Applications Service Provider) the MVC system par excellence is Java servlets, for example, the Tomcat implementation. For those of you who know the subject better than I do it is what in java they call struts. If any of you already knows it and wants an implementation of the same made in PHP I recommend you take a look at phpMVC.

As I was saying, I discovered all this in depth through Tony and he himself has a document that I think is very good, which explains how to implement an MVC model directly on PHP without going through a specific frameWork. The document in question is called The Model-View-Controller (MVC) Design Pattern for PHP. If like me before tackling documents like this you need an intro to the subject, the Java documentation about MVC and struts I would say is very good. Specifically I recommend the following chapters:

A good drawing so that those who find what I say unfamiliar can see that the model is very useful:

web-tier8.gif

From the Oracle documentation about MVC models I have found a graphic that applies the theory presented in the previous graphic and documents from a graphic applied directly to explaining the MVC acronym:

mvc.jpg
MVC model

Back to the PHP subject there are many more frameworks and websites that talk about MVC on this language. But perhaps the ones that have looked best to me, without having had the luck to be able to try them calmly and quietly, are the ones I list below:

  • phpMVC as I said before I would say it is one of the most complete frameworks that implement MVC, especially because in the data access layer and in the presentation layer it supports such well-known libraries as: PEAR, phpLIB, Smarty and many others. As I mentioned it is a direct implementation of the struts model used by java servlets.
  • cakePHP I would say it is the perfect MVC library to quickly program an application without having a learning curve that drags on too long.
  • WACT (Web Application Component Toolkit) also looks like it is not too complicated and I would say it is quite good. It seems to be designed so that we don't get lost when programming secure applications. But I don't see very clearly what shortcomings it has. Maybe the small user community?

Since I don't know much more about this subject, I refer you to a discussion I have found in a forum that seems quite interesting and of a high level. Besides, many people speak there with knowledge of the facts, which is appreciated, Tired of non-standards? Take a look. if that one seems too vague to you, another one: PHP Frameworks.

If any of the readers who is a computer scientist, or who simply knows much more than I do and can give us tools for mortals to master these techniques, I would be delighted to look at them.