Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the right MVC diagram for a web application?

Which MVC diagram is correct? Each have different arrows...

Diagram 1

Diagram 2


(source: stannard.net.au)

Diagram 3

Diagram 4


(source: sun.com)

Diagram 5


(source: shopno-dinga.com)

like image 239
Marcus Avatar asked May 11 '11 15:05

Marcus


People also ask

What is MVC design model in web application?

MVC (Model-View-Controller) is a pattern in software design commonly used to implement user interfaces, data, and controlling logic. It emphasizes a separation between the software's business logic and display. This "separation of concerns" provides for a better division of labor and improved maintenance.

What is MVC draw and explain MVC architecture for developing web applications?

The Model-View-Controller (MVC) is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. Each of these components are built to handle specific development aspects of an application.

Why MVC is used in Web application?

In the MVC architecture, developing different view components for your model component is easily achievable. It empowers you to develop different view components, thus limiting code duplication as it separates data and business logic. The MVC platform hugely supports the development of SEO-friendly web applications.


1 Answers

They all are.

MVC is a vague pattern.

My view on MVC is that :

Controller

Object has a collection of models and has methods for viewing and editing the models. It talks to Models and returns instances of Views with models applied on them.

View

Has the definition of a model attached to it and is just a set of functionality to display a specific model.

Model

Encapsulates data. Has methods for returning state and changing state.

//Controller import Views  class Controller   private Models  //View import Model  class View  //Model class Model 

A Model doesn't need to know anything about the View / Controller. A View needs to know the definition of a Model. A controller needs to own Models and needs to know definitions of Views.

You can couple them more tightly, that is optional.

like image 145
Raynos Avatar answered Sep 28 '22 03:09

Raynos