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 [] or [] tag instead. For Spring MVC, please use [spring-mvc] tag instead.

Filter by
Sorted by
Tagged with
2354 votes
24 answers

What are MVP and MVC and what is the difference?

When looking beyond the RAD (drag-drop and configure) way of building user interfaces that many tools encourage you are likely to come across three design patterns called Model-View-Controller, Model-...
Mike Minutillo's user avatar
1497 votes
44 answers

Passing data between view controllers

I'm new to iOS and Objective-C and the whole MVC paradigm and I'm stuck with the following: I have a view that acts as a data entry form and I want to give the user the option to select multiple ...
Matt Price's user avatar
  • 34.5k
1431 votes
24 answers

What is the difference between MVC and MVVM?

Is there a difference between the standard "Model View Controller" pattern and Microsoft's Model/View/ViewModel pattern?
Bjorn Reppen's user avatar
609 votes
9 answers

Separation of business logic and data access in django

I am writing a project in Django and I see that 80% of the code is in the file This code is confusing and, after a certain time, I cease to understand what is really happening. Here is what ...
defuz's user avatar
  • 26.8k
576 votes
5 answers

How should a model be structured in MVC? [closed]

I am just getting a grasp on the MVC framework and I often wonder how much code should go in the model. I tend to have a data access class that has methods like this: public function CheckUsername($...
Dietpixel's user avatar
  • 9,983
514 votes
21 answers

MVC pattern on Android

Is it possible to implement the model–view–controller pattern in Java for Android? Or is it already implemented through Activities? Or is there a better way to implement the MVC pattern for Android?
Mohit Deshpande's user avatar
399 votes
12 answers

What is a Data Transfer Object (DTO)?

In MVC are the model classes DTO? If not, what are the differences and do we need both?
Yaron Naveh's user avatar
  • 23.6k
342 votes
7 answers

Where to put model data and behaviour? [tl; dr; Use Services]

I am working with AngularJS for my latest project. In the documentation and tutorials all model data is put into the controller scope. I understand that is has to be there to be available for the ...
Nils Blum-Oeste's user avatar
242 votes
6 answers

What is difference between MVC, MVP & MVVM design pattern in terms of coding c#

If we search Google using the phrase "differences between MVC, MVP & MVVM design pattern" then we may get a few URL's which discuss the difference between MVC MVP & MVVM design ...
Thomas's user avatar
  • 33.6k
232 votes
5 answers

Can I get the name of the current controller in the view?

Is there a way to figure out what the current controller is from within the view? For an example of why I would want to know this: if several controllers share the same layout, I may have a part in ...
Dan Tao's user avatar
  • 126k
223 votes
9 answers

Java / Jakarta EE web development, where do I start and what skills do I need? [closed]

I want to learn, at least at a basic level, how to build Java web applications (coming from a .NET background). I would like to be able to build, deploy a simple CMS type application from the ground ...
mrblah's user avatar
  • 99.9k
208 votes
10 answers

Business logic in MVC [closed]

I have 2 questions: Q1. Where exactly does "business logic" lie in the MVC pattern? I am confused between Model and Controller. Q2. Is "business logic" the same as "business rules"? If not, what is ...
hmthur's user avatar
  • 2,555
199 votes
7 answers

Add directives from directive in AngularJS

I'm trying to build a directive that takes care of adding more directives to the element it is declared on. For example, I want to build a directive that takes care of adding datepicker, datepicker-...
frapontillo's user avatar
  • 10.5k
198 votes
13 answers

What goes into the "Controller" in "MVC"?

I think I understand the basic concepts of MVC - the Model contains the data and behaviour of the application, the View is responsible for displaying it to the user and the Controller deals with user ...
Paul Walker's user avatar
  • 2,716
194 votes
5 answers

Difference between Observer, Pub/Sub, and Data Binding

What is the difference between the Observer Pattern, Publish/Subscribe, and Data Binding? I searched around a bit on Stack Overflow and did not find any good answers. What I have come to believe is ...
Jess's user avatar
  • 24k
187 votes
10 answers

Spring Test & Security: How to mock authentication?

I was trying to figure out how to unit test if my the URLs of my controllers are properly secured. Just in case someone changes things around and accidentally removes security settings. My ...
Martin Becker's user avatar
184 votes
1 answer

DTO and DAO concepts and MVC [closed]

Why do we use DTO and DAO, and when should we use them. I am developing a GUI Java software to do with inserting, editing, deleting data. But I am struggling to distinguish between DTO/DAO and Model, ...
Hoody's user avatar
  • 2,942
178 votes
5 answers

Show pop-ups the most elegant way

I have this AngularJS app. Everything works just fine. Now I need to show different pop-ups when specific conditions become true, and I was wondering what would be the best way to proceed. Currently ...
Bruno's user avatar
  • 5,961
163 votes
12 answers

Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported for @RequestBody MultiValueMap

Based on the answer for problem with x-www-form-urlencoded with Spring @Controller I have written the below @Controller method @RequestMapping(value = "/{email}/authenticate", method = ...
Somasundaram Sekar's user avatar
158 votes
12 answers

Should sorting logic be placed in the model, the view, or the controller? [closed]

I have a drop down list that displays values from a table to the end user. I would like to have these values be sorted alphabetically. According to proper MVC design, at what layer should I place my ...
Ryan Kohn's user avatar
  • 13.1k
155 votes
10 answers

Rails Model, View, Controller, and Helper: what goes where?

In Ruby on Rails Development (or MVC in general), what quick rule should I follow as to where to put logic. Please answer in the affirmative - With Do put this here, rather than Don't put that there.
theschmitzer's user avatar
  • 12.2k
151 votes
7 answers

Limiting number of displayed results when using ngRepeat

I find the AngularJS tutorials hard to understand; this one is walking me through building an app that displays phones. I’m on step 5 and I thought as an experiment I’d try to allow users to specify ...
Captain Stack's user avatar
151 votes
12 answers

MVC Vs n-tier architecture

I was wondering what exactly is the difference between MVC(which is an architectural pattern) and an n-tier architecture for an application. I searched for it but couldn't find a simple explanation. ...
Arnkrishn's user avatar
  • 29.9k
135 votes
7 answers

How to include view/partial specific styling in AngularJS?

What is the proper/accepted way to use separate stylesheets for the various views my application uses? Currently I'm placing a link element in the view/partial's html at the top but I've been told ...
Brandon's user avatar
  • 4,485
135 votes
10 answers

How to render and append sub-views in Backbone.js

I have a nested-View setup which can get somewhat deep in my application. There are a bunch of ways I could think of initializing, rendering and appending the sub-views, but I'm wondering what common ...
Ian Storm Taylor's user avatar
134 votes
30 answers

Is there a JavaScript MVC (micro-)framework? [closed]

Are there any client-side JavaScript MVC (micro-)frameworks? I have a rather complicated HTML form, and it would benefit from the MVC pattern. I imagine a good solution would provide the following: ...
133 votes
2 answers

GUI not working after rewriting to MVC

I'm practicing MVC style programming. I have a Mastermind game in a single file, working fine (maybe apart of the fact that "Check" button is invisible at start). ...
trevor_nise's user avatar
  • 1,357
131 votes
7 answers

Unable to set data attribute using jQuery Data() API

I've got the following field on an MVC view: @Html.TextBoxFor(model => model.Course.Title, new { data_helptext = "Old Text" })</span> In a seperate js file, I want to set the data-helptext ...
Jason Evans's user avatar
  • 28.9k
129 votes
10 answers

Is MVC a Design Pattern or Architectural pattern

According to Sun and Msdn it is a design pattern. According to Wikipedia it is an architectural pattern In comparison to design patterns, architectural patterns are larger in scale. (Wikipedia - ...
JCasso's user avatar
  • 5,423
123 votes
4 answers

Django vs. Model View Controller [closed]

Can somebody explain me where the diferences are between Django and the Model View Controller pattern? Functionally, what can we expect from those differences — i.e. what works differently comparing ...
Leonardo's user avatar
  • 2,484
113 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 ...
Timothy Mowlem's user avatar
111 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 ...
gorn's user avatar
  • 5,081
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 ...
Jungle Hunter's user avatar
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 ....
kjv's user avatar
  • 11.1k
101 votes
4 answers

What components are MVC in JSF MVC framework?

In JSF MVC framework who is Model, View, and Controller?
yegor256's user avatar
  • 102k
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... <?php class MyController extends Controller { ...
Kirzilla's user avatar
  • 16.4k
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 <strong>@firstName @lastName</strong> which is accessible through a child only action like: [ChildActionOnly] public ActionResult ...
Saeed Neamati's user avatar
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"-...
James A. Rosen's user avatar
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 ...
Matthieu Napoli's user avatar
90 votes
4 answers

Fat model / thin controller vs. Service layer [closed]

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 ...
PeterFromCologne's user avatar
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,...
sbrattla's user avatar
  • 5,274
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?...
Erik Funkenbusch's user avatar
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 ...
Jaroslaw Stadnicki's user avatar
86 votes
2 answers

Embedded statement cannot be a declaration or labeled statement

I am trying to create a user using claim identity I get this error while creating claims identity user. ApplicationUser user = new ApplicationUser { EmailConfirmed ...
husseinbaalbaki's user avatar
86 votes
12 answers

MVC: Where to put business logic? [closed]

First of all, I have seen many questions of this, but not enough reasoning behind that. If my question is not good enough and should be removed I'll understand. I have taken a look at, for example, ...
Andrius Naruševičius's user avatar
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 ...
AnonDCX's user avatar
  • 2,501
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 ...
Brian's user avatar
  • 25.5k
85 votes
4 answers

Differentiating between domain, model, and entity with respect to MVC

Can someone explain these 3 concepts and the differences between them with respect to an MVC framework along with an example. To me these appear almost equivalent, and it seems they are used ...
Martin Konecny's user avatar
81 votes
4 answers

Sails.js vs Meteor - What are the advantages of both? [closed]

I've been reading a lot on Nodejs and its frameworks and recently finished my first full javascript frontend (using Angularjs). I've decided that my next pet project will be a Nodejs adventure using ...
pedropeixoto's user avatar
  • 1,633
81 votes
11 answers

Are the roles of a service and a façade similar?

The more I read, the more confused I am. Note that all the question is related to how service and facades fit on the MVC pattern. My understanding is that a Facade is not a super-smart object, it ...
Juan Antonio Gomez Moriano's user avatar

2 3 4 5