MVC – why and why

Everyone recommends to teach/use/pray in MVC.

I encounter it mainly in Joomla, but I developed an allergy to the noob application: for example, I went to the template.phpfile, and it says:

<?php $this->view->printHTML(); ?>

And accordingly, I’m looking for this function by files, it includes three more files, require in a loop, and the like. I understand that this is not “pure MVC”, but when the template is used everywhere, even if the main framework is not adapted for this + provokes such a mess of superfluousfiles, it worries me.

And the question itself: all my life, as it turned out recently, I used facadeor simple a couple of code(function/class/require)+template for simple modules. For a pair of encoder + layout designer, the second seems ideal to me.

How is MVC better and are there more adequate patterns for teamwork?
Or is “MVC” just another cool abbreviation for indirect brain massage for employers?


Answer 1, authority 100%

Christmas tree, what am I reading here!?

Guys. If you come across bad code and the bad programmer wrote

And, accordingly, I am looking for this function by
files, it includes three more
file, require in a loop, and volume
similar.

This is not a problem of the MVC Architecture – it is a problem of crooked hands, a dull head and misunderstanding.

MVC is very convenient.

If you are interested in learning about the time frame of creation, then using the YII Framework, the admin panel for the site can be made in about an hour to 3 hours. Let it not be “Oh, how beautiful”, but fully functional.

MVC is cool!

A programmer, provided that he uses the Framework, only needs a logical representation of his project and an understanding of the principles of the MVC architecture.

For most frameworks, the first demo for noobs is to create a “BLOG”, for what? Well, usually, in a good case, almost all web developers make their own blog, but here it is again – and raise it on any framework in 10-30 minutes, you can cool it. It will also check for entered characters through small manipulations, and check for filling, and so on, so on, so on.

Those who came across, again, I repeat, with the noob codes of the guys, tear out these hands from those who wrote, but do not swear at the architecture. If you didn’t feel it or didn’t understand it, it doesn’t mean that it’s bad. Rather, you are not competent in the matter, and not the architecture, because huge projects are being developed on it, including highly loaded ones.

The advantages of MVC can be listed for a long time, there are also disadvantages.

Suppose, how long will you write caching on your resource? Well, probably, spend exactly a day or two, this is with a good set of circumstances, and even then, I’m not sure, because you need to apply it to the entire code.
And in MVC, you just add, God forbid, 2-10 lines to the code and rejoice that your resource hammers the database less, sends more cache to the user, everyone is happy, the owner is happy. The server is resting.

I can write and paint for a long time, but pounding on the wall is wrong. The noobs are hammering into the wall, I really hope that there are still a very small number of them on this resource.

Learn the hardware, read about the MVC architecture, learn, and try to understand with examples!

Good luck.


Answer 2, authority 22%

I will answer regardless of the language and platform regarding the appropriateness of MVC as such. I recently participated in the development of an application (such as a virtual keyboard), almost all of the functionality of which was reduced to the user interface. The application was written in WPF using MVVM (it’s not MVC, but close enough). Why was the MVVM based approach chosen? Because it makes testing a lot easier: minimizing the view allows you to test the model and controller separately. View testing is limited to external viewing of the interface. It’s worth it.