Is MVC the only way to write PHP?

The huge number of frameworks available for PHP now uses MVC. Even ASP.net has its own MVC module.

I see the appeal of MVC, I really can and often use it. The only drawback that I see is that you have to start the whole system to execute the page request. Depending on your task, this can be a bit wasteful.

So the question is. In a professional environment, is this the only way to use PHP these days or other design methods that have alternative advantages?

+5
source share
2 answers

I don't like it when someone tells me how to write code. If I want to use MVC, if I find a better way to solve a specific problem, I will use it. I don’t like it when people turn MVC into a religion. I also think that many php encoders misunderstand the concept of MVC and think that they use the MVC pattern when in fact most of the time they do not use 100% pure MVC. The truth is that it is not easy and not very efficient to write a website that is 100% MVC and written in php.

Most people have the greatest difficulty in the "V" part of MVC. M is easy. This is your data. If you store your data in a database and have a database access class, then your "M" part, you are good with "M"

: , php- "M" ( ), , , , " login", .. "C" .

, , "V" View "C" (). php. html, .

MVC, , , View , HTML. php. , html. , , . , php, , , , .

, , XSLT, php, php, , , , , , . XSLT , Java. . , XML. , , 100% XML php, DOM, php. , . : XML , XML HTML XSL-. XSLT php.

, , . , , "V" MVC?

"M" , "C" - php-, , . "", .

, - MVC. , html .

+13

All Articles