MVC (Model-View-Controller) is a software architecture pattern that enforces separation of concerns.

learn more… | top users | synonyms

61
votes
13answers
6k views

Why is it a good idea for “lower” application layers not to be aware of “higher” ones?

In a typical (well-designed) MVC web app, the database is not aware of the model code, the model code is not aware of the controller code, and the controller code is not aware of the view code. (I ...
86
votes
10answers
40k views

What is MVC, really? [closed]

As a serious programmer, how do you answer the question What is MVC? In my mind, MVC is sort of a nebulous topic — and because of that, if your audience is a learner, then you're free to ...
44
votes
6answers
36k views

Why should I use an MVC pattern?

It seems everyone doing web applications nowadays wants to use MVC for everything. I find it hard to convince myself to use this pattern, however. I understand the general idea is to separate the ...
20
votes
3answers
14k views

Where to put business logic in MVC design?

I have created a simple MVC Java application that adds records through data forms to a database. My app collects data, it also validates it and stores it. This is because the data is being sourced ...
25
votes
2answers
18k views

Mixing Angular and ASP.NET MVC/Web api?

I come from using ASP.NET MVC/Web API and now I am starting to use Angular but I am not clear on the proper way to mix them. Once I am using Angular does the MVC server side concepts still provide ...
22
votes
4answers
18k views

Why put the business logic in the model? What happens when I have multiple types of storage?

I always thought that the business logic has to be in the controller and that the controller, since it is the 'middle' part, stays static and that the model/view have to be capsuled via interfaces. ...
14
votes
8answers
3k views

How do you organize your MVC framework while supporting modules/plugins? [closed]

There are a two main codebase structures that I have seen when it comes to MVC frameworks. The problem is that they both seem to have an organisational bug that goes with them. Standard MVC ...
7
votes
2answers
7k views

.NET MVC project architecture / layering

When planning the architecture for a mid-large scale MVC web application how do you implement the layers to be as decoupled as possible and easy to test? (basically follow best practices) Let's say ...
17
votes
2answers
5k views

Alternative patterns for web development? (non-MVC)

Recently I've been reading some blog posts regarding MVC and how it doesn't fit the web. I've learned about alternative patterns like the RMR Architecture. I'm curious what other patterns people are ...
10
votes
4answers
2k views

In MVC, can/should basic data retrieval from the Model be done in the View?

Given the concept of 'skinny controllers, fat models' and the general acceptance that Views can directly call on Models when requiring data for output, should one consider handling the 'get and ...
21
votes
6answers
3k views

How much business logic should be allowed to exist in the controller layer?

Sometimes we have some business logic represented in the controller code of our applications. This is usually logic that differentiates what methods to call from the model and/or what arguments to ...
10
votes
3answers
2k views

Is the term 'Front-End' synonymous with 'Client-Side'? If so, is this always the case?

As a relatively new (self-taught) web developer, I've heard the terms front-end, client-side, back-end, and server-side quite often. To me, front-end and back-end were always synonymous with ...
4
votes
2answers
940 views

How does MVC work with the principle “Tell, Don't ask”?

Procedural code gets information then makes decisions. Object-oriented code tells objects to do things. — Alec Sharp So, when a view wants to display some information that is suppose to be ...
11
votes
4answers
5k views

Why would you use MVC over Web Forms?

Recently an architect described our company as offering a Rolls-Royce solution (MVC) when all he needed was a Toyota (Web Forms). I'm curious to find out what you think about web forms vs MVC as an ...
5
votes
1answer
920 views

Should website frontends be rendered in client-side or server-side?

I've been talking to a colleague that comes from AS3 to the HTML world. He has created a small website (there are apparently no dynamic contents) following the no-flash rules for his very first time, ...
4
votes
4answers
2k views

Building websites, which is the better approach MVP or MVC?

I'm looking for feedback on MVP and MVC patterns used as a framework to build a website. I've used both with a certain degrees of success and failure. Furthermore I've worked in places which have ...
2
votes
1answer
361 views

Do I need JUnit tests for the controller layer on a MVC when I have a database layer

I have a MVC which has this structure: ui controller db model Basically the controller doesn't really do much more than connection ui with db layer. Do I need to provide JUnit tests for the ...
2
votes
3answers
3k views

What is the actual purpose of MVC?

I've seen a lot of stuff that describes how it's done, but not a lot that tells WHY it's done. Is it just a way to keep the code readable, or is there a better reason?
0
votes
3answers
485 views

What are the steps to grouping related classes into packages

What are the steps needed to be taken to group related classes into packages in Java? In my case, I have about a number of .java files that I'd like to group into 3 packages according to the MVC ...
35
votes
14answers
12k views

Isn't MVC anti OOP?

The main idea behind OOP is to unify data and behavior in a single entity - the object. In procedural programming there is data and separately algorithms modifying the data. In the ...
17
votes
10answers
4k views

Best practice or design patterns for retrieval of data for reporting and dashboards in a domain-rich application

First, I want to say this seems to be a neglected question/area, so if this question needs improvement, help me make this a great question that can benefit others! I'm looking for advice and help from ...
7
votes
3answers
8k views

Best Architecture for ASP.NET WebForms Application

I have written an ASP.NET WebForms portal for a client. The project has kind of evolved rather than being properly planned and structured from the beginning. Consequently, all the code is mashed ...
13
votes
4answers
4k views

Explain Model View Controller

My experience with developing dynamic websites is limited mostly to Java servlets. I've used Tomcat to develop various Java servlets, and I wouldn't hesitate to say that I'm reasonably proficient ...
15
votes
5answers
5k views

In an MVC system, where should the database persistence code sit?

I've seen multiple configurations for persisting information to the database. Generally, three types of designs seem common in my corner of the world: Controller manages the persistence Model ...
10
votes
2answers
10k views

Use-cases for node.js and c#

I do quite a bit of ASP.NET work (C#, MVC), but most of it is typical web development. I do Restful architecture using CRUD repositories. Most of my clients don't have a lot of advanced requirements ...
7
votes
4answers
3k views

Most MVC-strict php framework

I have been trying to wrap my head around MVC pattern for about 6 months.I've read tons of articles, Q&A, and blog posts about MVC and HMVC patterns, but I just simply don't get it 100%. I tried ...
5
votes
3answers
6k views

MVVM or MVC? Want to use the same set of classes for WPF and ASP.NET

I am a newbie in terms of Design Patterns. I just started learning MVC when I am hearing a new buzz, MVVM. I want to learn the insights of both of these by redesigning an old inventory and invoicing ...
13
votes
8answers
3k views

Does MVC apply only to web

It is almost and instantaneous whenever I talk to developers about Model View Controller (MVC) they say you make a request to a url the server builds a entity (MODEL) and provides you with visual ...
5
votes
5answers
2k views

JQuery / JSON + .Net Service Layer - to WCF or Not to WCF?

I Recently had a discussion with a colleague of mine about the pros / cons of WCF. He mentioned about how much code is generated to support WCF, and also the overhead required. It was mentioned that a ...
4
votes
2answers
647 views

Problem sets or challenges and solutions for beginners to practice MVC, OOP, MVT etc. type problems [closed]

Coding bat, project euler, python challenge for example are all amazing brain teasers that usually provide you with some learning material, ways to compact your code, and enhance your problem solving ...
3
votes
5answers
456 views

Is SOA suitable for developers or only for business/IT management people?

Let's suppose you're the lead of a team of developers that needs to build a big information system such as an ERP or Human Resources software, or whatever system that is composed by multiple business ...
3
votes
4answers
4k views

Use a service layer with MVC

If a controller gets to fat and model instantation starts to add up a service layer could be used. If I just wrap the logic inside a service class I will get a bunch of Services with one/two ...
2
votes
7answers
1k views

Architectural patterns for interaction beyond MVC? [closed]

We all know the venerable Model-View-Controller pattern used to design interaction [mostly] with human users. It is the de-facto standard in OOP environment. What are some other architectural ...
1
vote
2answers
2k views

Do modular PHP frameworks really improve applications?

One of the goals of modular frameworks like Kohana or Alloy is to make it easy to add and remove components (i.e. "plugins" or "modules"). However, in all the larger projects I have ever worked - the ...
15
votes
6answers
1k views

Strategies for avoiding SQL in your Controllers… or how many methods should I have in my Models?

So a situation I run into reasonably often is one where my models start to either: Grow into monsters with tons and tons of methods OR Allow you to pass pieces of SQL to them, so that they are ...
15
votes
7answers
2k views

Is the MVC pattern used in industry a lot? What's all the hype? [closed]

I'm a student but I am hopefully moving into the software industry soon. There seems to be a lot of hype about the MVC software pattern. I noticed that PHP frameworks are often MVC, what about ...
2
votes
1answer
101 views

Translating views in MVC

What is the best practice, when it comes to views' translation in MVC design pattern, in multilingual website: Always have only one view file and translate its particular strings with a framework ...
2
votes
2answers
722 views

Obtaining the best of both worlds: MVC and WebForms

Rather than asking a general question about WebForms vs MVC (such as in ASP.NET v/s ASP.NET MVC), I have a specific quesiton. It appears the main differences between the two approaches are WebForms ...
0
votes
1answer
182 views

In MVC, why can't a model create a view?

I have a web application written in Perl with a controller, some "views" and some "Models". Each "Model" is corresponding to one "View". The controller (one file) creates an Model object ...
6
votes
1answer
236 views

Testing: deterministic or non-deterministic?

Is it better to have either a Deterministic test suite, that results in the same tests succeeding Non-deterministic test suite, which potentially possibly covers more cases ? Example: You write a ...
5
votes
5answers
894 views

Multi MVC processing vs Single MVC process

I've worked fairly extensively with the MVC framework cakephp, however I'm finding that I would rather have my pages driven by the multiple MVC than by just one MVC. My reason is primarily to maintain ...
2
votes
1answer
60 views

Proper MVC design and helper classes

I've been reading into Model-View-Controller and was wondering where something like a XyzClient class would fit into this design. Splitting up MVC is easy when all you have are some views to display, ...
2
votes
4answers
1k views

To MVC or not MVC, that is the question

Originally, I started off doing jQuery plugins, then moved onto Backbone.js applications, then been experimenting with MicroJS MVC modules, but these days I'm even wondering if there is any need for ...
2
votes
0answers
263 views

Is this any form of service pattern, some other pattern, SOA or just an anti-pattern?

I'm going to set out a scenario/pattern I've encountered and then I have a few questions pertaining to it. During an MVC request in a web framework (PHP, Laravel in my case), if I have an abstract ...
2
votes
5answers
299 views

Organizing my products database

I’m developing a web-based store in MVC (very closely based on the SportsStore example in Pro ASP.Net MVC 3 Framework http://www.powells.com/biblio/61-9781430234043-0). I’m using a SQL database and ...
1
vote
1answer
172 views

Static controllers

I have built myself a PHP MVC framework to meet my needs. As pretty much all of the core classes are static, I just stumbled upon the idea of having static controllers. I know that for some reason ...
1
vote
2answers
272 views

Good Programming Practice for similar child classes

I am developing an iOS application, in which I have to draw some patterns on a view based on option selected by user. Let me explain you more clearly. User will be shown number of images as options ...
0
votes
2answers
139 views

MVC sending information from view to controller

I am using the MVC pattern. Lets say I want to create a new object and add it to my database. Where is it better to create the new object: View: Boo boo = new Boo("awesomness"); ...