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
5
votes
2 answers

javascript asynchronous calls that populate some property

I have an javascript object that includes some image strings as its property. Upon instantiating this object, an AJAX call is made immediately to populate this property. My view functions, at the same time, tries to read newly instantiated instances…
jet
  • 698
  • 6
  • 12
5
votes
3 answers

How to access events of View from Controller

My question is regarding implementing MVC pattern in winforms I learned that the controller object is responsible for handling the events raised in the view. Can any one please tell me how can the controller reacts to the text input or button press…
logeeks
  • 4,849
  • 15
  • 62
  • 93
5
votes
3 answers

Where to put validation logic in MVC software architecture

I am actually starting to learn the mvc architecture. I'm confused on whether to place my username registration validation logic in model or in controller. I have some sort of status message that would tell the user whether the new username to…
Neigyl R. Noval
  • 6,018
  • 4
  • 27
  • 45
5
votes
7 answers

Purpose of Javascript MVC frameworks

I am wondering the purpose of Javascript MVC frameworks such as Backbone.js and Spine.js. As an avid/experienced Ruby on Rails developer, I never had a useful case where I needed another MVC layer for my application. It just seems rather silly to…
Chris Ledet
  • 11,458
  • 7
  • 39
  • 47
5
votes
3 answers

Grails redirects to wrong address when using app.context?

I'm noticing some odd behavior with redirect when I set my app.context a certain way. I found a bug in the Grails JIRA which describes my problem perfectly, but it was marked as UTR: http://jira.grails.org/browse/GRAILS-7546 Here is my description…
DigitalZebra
  • 39,494
  • 39
  • 114
  • 146
5
votes
2 answers

get a list of defined zend routes

so you can add routes in zend framework with Zend Router's addRoute() method... but what if I want to get a list of all the defined routes? is there a method that I can use to do so?
kamikaze_pilot
  • 14,304
  • 35
  • 111
  • 171
5
votes
6 answers

General questions about frameworks

Ok so I've been programming in PHP for several years now. I always enjoyed building content systems from the ground-up for practice (forums, blogs, comics, general CMSs etc), however in the past few months I have come to the conclusion I am focusing…
casraf
  • 21,085
  • 9
  • 56
  • 91
5
votes
3 answers

Using Multiple Interfaces with MVC DataAnnotations and MetaDataType

I am applying validation using DataAnnotations to an MVC ViewModel which is a composite of several entity framework objects and some custom logic. The validation is already defined for the entity objects in interfaces, but how can I apply this…
dhochee
  • 412
  • 4
  • 11
5
votes
3 answers

Rendering a form from another controller in Ruby on Rails 3

Ok, the problem is trying to render a form from a controller to create a new entry.. For that im calling the default form that comes with the scaffold creation I'm trying to make it like this: <%= render :partial => 'contactos/form' %> And im…
5
votes
3 answers

Is domain model object passing between layers overhead?

I am working on a project that uses hibernate and spring. Hibernate is encapsulated in a DAO layer and the DAO layer has corresponding service layer as well, theres also the controllers that is mapped for requests and JSP pages. I was told not to…
Thihara
  • 7,031
  • 2
  • 29
  • 56
5
votes
2 answers

Building a Play framework module for sharing a data layer among several services

Keeping the notion of a SOA in mind, my intent is to provide several different services, which leverage the same data model. Imagine a poker application - we may have the following services: Game frontend Administrative frontend Player rank /…
idbentley
  • 4,188
  • 3
  • 34
  • 50
5
votes
2 answers

MVC for desktop app with no data layer

Question might be tricky (because of its nature or my way of describing it), so really read this before answering. I have this app to write: a) desktop app; b) no data layer in sense of database, files or any other repository (no need to save,…
yoosiba
  • 2,196
  • 1
  • 18
  • 27
5
votes
4 answers

How much code in a rails view is ok?

I know that it is best to keep code out of the presentation layer. But, I am wondering how much is considered "acceptable". For example I populate an html select box with this line of code. CodesecureProject.find(:all,:order => 'name').collect…
Josh Moore
  • 13,338
  • 15
  • 58
  • 74
5
votes
4 answers

How much GUI logic is too much in MVC?

I'm writing a little Java desktop application and I'm using an MVC pattern. I've read about how logic should be kept in the model, but there are some places where logic has to be applied but is completely related to how the GUI functions. I've…
Sea Citadel
  • 195
  • 1
  • 6
5
votes
7 answers

passing variables in a mvc pattern

I have built a system that conforms to the mvc pattern in PHP. The controllers and actions are part of the urls in my application. So I have: www.example.com/controller/action/ So now I am looking for a way to pass on variables. For forms I just use…
sanders
  • 10,794
  • 27
  • 85
  • 127
1 2 3
99
100