Jump to content

Recommended Posts

It's an architectural pattern, or - in other words - a well-tested recipe, how to organize the structure of your application in order to get certain benefits. You can implement it yourself, or use an application framework that does it for you. If you do not know what design and architectural patterns are, you should try to learn something about object-oriented programming and object-oriented design.

 

MVC is an ancestor of the whole family of patterns. In the webdevelopment circles, most articles claiming they describe MVC, actually describe one of its distant descendants.

Link to comment
https://forums.phpfreaks.com/topic/231163-what-is-mvc/#findComment-1189836
Share on other sites

MVC stands for Model-View-Controller and like Zyx pointed out it's an architectural pattern. MVC is an example of good Separation of Concern (SoC), each part has a clear responsibility.

 

For the View this is rendering the interface, and communicating changes to the Model (at least in it's original design, for PHP this will be the Controller due to the View being remotely manipulated).

 

The Model does the actual work. For example, I am typing this text in this textarea and when I submit it, the text will be passed to the Model and in turn will insert it into some data store. And upon you visiting this page, will retrieve it.

 

The Controller ties the Model and the View together in order to handle a request. For example, when you open Excel and choose File > Open a dialog appears, the Controller handled the request (I want to open a file), the Model loaded the files under a certain directory and the View rendered the dialog (when you click on a directory, the View will communicate this change to the Model and it will load the new directory contents).

 

In PHP this would be that you visit /user/edit/1 which indicates you want to edit a user with ID #1, the Model will retrieve the user from the database with ID #1, the View will render the form. And when you submit it will be passed back to the Controller, which passes the POST data to the Model to store it in the data store.

 

Like I said earlier, the MVC is different for local and remote apps.

Link to comment
https://forums.phpfreaks.com/topic/231163-what-is-mvc/#findComment-1189864
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.