Questions tagged [model-view-controller]

Model–View–Controller (MVC) is an architectural pattern, introduced in mid 1970-s in PARC into how to compose software interfacing also with user-interactions. For Microsoft ASP.NET MVC, please use [asp.net-mvc] or [asp.net-core-mvc] tag instead. For Spring MVC, please use [spring-mvc] tag instead.

Model–View–Controller (MVC) is an architectural pattern used in software engineering, since Palo Alto Research Centre released one such in mid 1970-ies, designed in Smalltalk-79 language.

The pattern isolates "domain logic" (the application logic for the user) from the user interface (input and presentation), permitting independent development, testing, portability and maintenance of each (separation of concerns).

Image which demonstrates typical collaboration of the MVC components:

MVC

Reference

The analogy

MVC can be metaphorically related to a TV. You have various channels, with different information on them supplied by your cable provider (the model). The TV screen displays these channels to you (the view). You pressing the buttons on the remote controls affects what you see and how you see it (the controller).

33635 questions
112
votes
7 answers

What is the difference between an MVC Model object, a domain object and a DTO

What is the difference between a MVC Model object, a domain object and a DTO? My understanding is: MVC Model object: Models the data to be displayed by a corresponding view. It may not map directly to a domain object, i.e. may include data from one…
Timothy Mowlem
  • 1,121
  • 2
  • 8
  • 3
110
votes
6 answers

Why Qt is misusing model/view terminology?

I think that the terminology used in Qt with model/view controls is flawed. On their explanation page they state, that they simplified the MVC to MV by merging View and Controller and they are giving the following picture: However I think, they…
gorn
  • 5,042
  • 7
  • 31
  • 46
107
votes
3 answers

Fat models and skinny controllers sounds like creating God models

I've been reading a lot of blogs which advocate the fat models and skinny controllers approach, esp. the Rails camp. As a result the routers is basically just figuring out what method to call on what controller and all the controller method does is…
104
votes
6 answers

Implementing MVC with Windows Forms

Where can I find a good example on how to completely implement the MVC pattern in Windows Forms? I found many tutorials and code examples on various sites (for example, The Code Project and .NetHeaven), but many are more representative for the…
kjv
  • 11,047
  • 34
  • 101
  • 140
101
votes
4 answers

What components are MVC in JSF MVC framework?

In JSF MVC framework who is Model, View, and Controller?
yegor256
  • 102,010
  • 123
  • 446
  • 597
98
votes
3 answers

How can I implement an Access Control List in my Web MVC application?

First question Please, could you explain me how simpliest ACL could be implemented in MVC. Here is the first approach of using Acl in Controller...
Kirzilla
  • 16,368
  • 26
  • 84
  • 129
97
votes
8 answers

How to pass parameters to a partial view in ASP.NET MVC?

Suppose that I have this partial view: Your name is @firstName @lastName which is accessible through a child only action like: [ChildActionOnly] public ActionResult FullName(string firstName, string lastName) { } And I want to…
93
votes
7 answers

How do I fetch a single model in Backbone?

I have a Clock model in Backbone: var Clock = Backbone.Model.extend({}); I'm trying to get an instance of that that has the latest information from /clocks/123. Some things I've tried: a "class"-level method Clock.fetch(123) // TypeError: Object…
James A. Rosen
  • 64,193
  • 61
  • 179
  • 261
92
votes
3 answers

MVCS - Model View Controller Service

I've been using MVC for a long time and heard about the "Service" layer (for example in Java web project) and I've been wondering if that is a real architectural pattern given I can't find a lot of information about it. The idea of MVCS is to have a…
Matthieu Napoli
  • 48,448
  • 45
  • 173
  • 261
90
votes
4 answers

Fat model / thin controller vs. Service layer

I have been developing enterprise applications for many years using .Net My apps usually have a domain model containing entities mapping to SQL DB tables. I use a Repository pattern, Dependency injection and a service layer. Recently we started…
87
votes
7 answers

The MVC pattern and Swing

One of the design patterns which I find most difficult to get a real grasp of in "real Swing life" is the MVC pattern. I've been through quite a few of the posts at this site which discuss the pattern, but I still do not feel that I have a clear…
sbrattla
  • 5,274
  • 3
  • 39
  • 63
87
votes
4 answers

Where does the "business logic layer" fit in to an MVC application?

First, before anyone screams dupe, I had a hard time summarizing it in a simple title. Another title might have been "What is the difference between a domain model and MVC model?" or "What is a model?" Conceptually, I understand a Model to be the…
86
votes
4 answers

How does differential execution work?

I've seen a few mentions of this on Stack Overflow, but staring at Wikipedia (the relevant page has since been deleted) and at an MFC dynamic dialog demo did nothing to enlighten me. Can someone please explain this? Learning a fundamentally…
Brian
  • 25,523
  • 18
  • 82
  • 173
86
votes
6 answers

Angular design pattern: MVC, MVVM or MV*?

Angular 1.x (AngularJS) was following more or less the MV* design principle because of its two-way data binding functionality. Angular2 is adopting a component-based UI, a concept that might be familiar to React developers. In a sense, the Angular…
AnonDCX
  • 2,501
  • 2
  • 17
  • 25
86
votes
7 answers

How and where to define an environment variable on Azure

I have an ASP.NET MVC web application deployed to Azure. I'm reading my setting using the GetEnvironmentVariable(...) method. The problem is that I can't find a way to define this environment variable in Azure Portal. Where can I do that? I don't…