lundi 25 janvier 2016

Can we clear the confusion about MVC in php?

I'm here again. Still studying MVC.

Well there's a tone of contradictions around the web. I would like to clear all those things. But i can't because i'm still a noob in that. So to avoid learning wrong things i would like to ask you about this point.

THE MODEL VIEW CONFUSION (AKA MVC)

Jokes apart, this title reflects the web confusion about the MVC pattern ''implemented'' in PHP.

There are articles who says that the MODEL and the VIEW will NEVER interact directly. Instead the CONTROLLER takes place and handle the situation.

It ask the model to do something and return something, then it ask to the view to present the data that the model returned. All fine, right?

NOPE

I've landed here, where it says the complete opposite.

For example, this article on sitepoint which states:
"It is important to note that in order to correctly apply the MVC architecture, there must be no interaction between models and views: all the logic is handled by controllers."

This is wrong. It specifies this nowhere in MVC. In fact, it states the exact opposite. This article is a good example because it epitomises the attitude of most PHP developers and what's taught as "MVC" throughout the PHP community.

So, who is right then? Can the view acess directly to the model or not?

Aucun commentaire:

Enregistrer un commentaire