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

learn more… | top users | synonyms

-2
votes
2answers
212 views

Angular JS vs Modern MVC frameworks

I might be wrong for some things here, but here is what I recently though about. Modern frameworks MVC such as ASP.NET MVC 5, CakePHP, Java Spring etc. has their logic clearly separated into Models ...
7
votes
4answers
263 views

Encapsulation for complex queries

I tried asking this question first on StakOverflow in a more concrete manner, but after being pointed here I realized I should rephrase it in more general terms; however, you can still review the ...
2
votes
3answers
130 views

Is Model a better place to set HTTP status code?

In MVC usually the controller sets whatever needs to be sent back to the client/View, including HTTP status code, e.g.: class Controller { public function get(Request req, Response resp) { ...
2
votes
2answers
427 views

What did the reviewer refer to in this code review?

I sent the code for a job application and got the following review: Regarding the Project Structure: Physical separation is absent. Logical separation is present but not up to best practices. Things ...
3
votes
1answer
55 views

Logic and Values in View or Controller

I have an application built using an MVC framework (for argument's sake, PHP/Yii2) and have a question regarding where to carry out logic and generate values which will be injected into, for example, ...
2
votes
2answers
131 views

Where to put User Interface/Domain Model manipulation logic (transferring data from the view to Domain Model)

We are starting on a greenfield project in ASP.NET MVC. I've used the MVC pattern in other stacks (PHP and Ruby) and I keep running into the same problems of where to place business logic, UI logic, ...
1
vote
1answer
127 views

How far do I separate Model code from Controller code when writing MVC?

I have some code where Controller depends on the Model, and in my case Model acts like a Database Access Object. use FQDN\Model; class Controller { /** @var FQDN\Model */ private $model; ...
7
votes
2answers
181 views

Am I using Zend Form library correctly? (I am effectively duplicating work in Controller and in View)

Brief Summary This question is asking for guidance on how to deal with Zend Form library that allows me to specify how to construct each form element (Controller side) and how to render each element (...
6
votes
3answers
668 views

Why does everyone put controllers in one folder and views in another?

I'm getting ready to take the bend out of asp and into an mvc framework, asp.net mvc or nancy. Wherever I go, I see folders for controllers/modules and folders for views. Is this just a pavlovian ...
5
votes
1answer
283 views

Who communicates with the database in MVC/MVP?

I am building a small application and want to save my business objects to a database. I have my business objects and a model that acts as a container for my business objects and provides methods for ...
4
votes
1answer
122 views

Increase code duplication to simplify business rules in views

I am in the process of writing a Ruby on Rails web application for my university's department. For some of our resources in the web application, e.g. Project, are complex with their view layer logic: ...
1
vote
0answers
30 views

MVC WebApplication as MQ Subscriber

We have a Web (.Net MVC5) application that we are looking to start offloading some of the heavy processing off the Web Application to a distributed services layer. As part of this process we are ...
0
votes
0answers
85 views

Proper way/place to apply decorator pattern for view layer in mvc

I have an array of model objects containing data some of which is states represented by integers. In the view these states are shown as icons and tooltips. The tooltip is needed only in the view and ...
5
votes
3answers
449 views

“Smart create” method naming

Every class of a model in my application has a create method. The framework gives me the default implementation of create which is “create in the DB”. Sometimes I need to perform some extra actions ...
1
vote
1answer
135 views

How to compute Pricing of Product & Options based on User Option Selection and Pricing per Option

I am building a service for pricing options of a product and for pricing the product itself when product has various options. Example User selects some X options out of Y options available, where X &...
1
vote
0answers
43 views

Why separate routes and controllers in MVC backend applications?

I've dabbled in a few MVC frameworks (like Rails and its ilk) and I've noticed that the file that defines restful routes often go separate from controllers which hold the actions executed through ...
0
votes
2answers
219 views

Should a Junior programmer add TDD tests to mvc project

I'm a junior programmer near to my 6 month probation, following my initial career changing 3 month assignment in which I added TDD tests and wondering whether I should add tests to my current work. ...
6
votes
1answer
231 views

MVC - Do I create 'joint' layers when dealing with multiple models?

I'm new to MVC and the different layers architecture and this is what I have currently: 2 models: User, Company 2 service layers: UserService, CompanyService 2 interfaces which abstract the ...
1
vote
1answer
154 views

c# extending a entity framework class

I have a Entity Framework class that was derived from the database layout. I was wondering if there was any problems by extending the class by creating another cs file and using the same public ...
2
votes
2answers
230 views

Do common MVC frameworks violate the LSP and is there a MVC framework which does not?

You who have worked with a framework implementing the MVC architectural pattern most likely know how these frameworks are usually implemented. They contain a base Controller class, which you extend, ...
1
vote
1answer
374 views

JavaScript & AngularJs Modules Implementation technique and structure

So Im building an app and I'm trying to implement the structure of the app so that its robust and scalable in future. My app is mostly divided into JavaScript Modules (revealing pattern): // filter....
1
vote
3answers
139 views

Is a TCP client/server a good solution for a system which can be controlled by a GUI running on multiple platforms?

Consider a software which runs on a dedicated system (basically a Linux box), and controls some machinery. The system has all the required hardware interfaces for the task. The software also has a GUI ...
-1
votes
1answer
87 views

(Re)structuring a Qt Project [closed]

A PySide project I've been working on for a while now has started to grow to a point where it's becoming large enough that I've had to step back and re-think the overall design. I've spent some time ...
0
votes
1answer
67 views

static method, helper function or in the controller, where does this go?

I'm working on a piece of functionality that simply allows a guest user to perform an action a certain number of times before requiring them to login\create account. In this instance, they can vote on ...
-1
votes
2answers
218 views

Creating an ASP.Net MVC web application that can work on different operating systems

I have been developing and deploying many ASP.Net MVC web applications under Windows Server 2008 R2 & Windows Server 2012 R2, and I used IIS 7 & IIS 8. At the same time I know that I can ...
1
vote
2answers
76 views

Should a client check for persisted item existence before modifying it?

I'm developing a MVC Web application with a REST interface. The REST controller performs actions on persisted items through a service class, which translates exceptions coming from the persistence ...
1
vote
3answers
182 views

What is the correct name for this data object?

I need to understand the proper name for an object that has cropped up in two projects now. Here is the conventional representation for the MVC pattern: However there is another "Model" that is ...
2
votes
2answers
585 views

is it bad practice that controller call repository instead of service?

is it bad practice that controller call repository instead of service? to explain more: I figure out that in good design controllers call service and service use repository. but sometimes in ...
0
votes
1answer
193 views

If AngularJS already takes care of the MVC, would using ReactJS be needed if it is just the View part?

I heard that AngularJS is becoming quite popular, and at the same time ReactJS is also. But if AngularJS already takes care of MVC with 2 way binding between model and view, would ReactJS actually be ...
4
votes
2answers
80 views

Multiple controllers for same resource based on user's Role

I'm having trouble designing this role (or permission) based application, when it comes to figuring out how to handle actions that differ per use role. For instance, our controller is App\...
2
votes
4answers
122 views

Can someone give me a good definition of the term “business logic”? [duplicate]

I kind of get what it means, but not enough to explain it by myself. Is a key concept when talking about the MVC pattern and it's giving me problems to explain that concept too.
1
vote
1answer
22 views

MVC Set or Read View Components

I often see the follwing example when reading about MVC (example is in Java, but question adapts to all OOP languages): class View{ JTextField tfName; public String getTfNameText(){ ...
-1
votes
1answer
152 views

PHP: where to call helper class in MVC?

I've a helper class in Laravel 5.1 with static methods for calculating week numbers, dates in weeks, etc. (Why static? I need max. 1 instance of this helper class) I need this logic in my views. I'm ...
2
votes
1answer
171 views

Business logic in the models?

I use the repository pattern for data handling. In my DAL folder i have IUserRepository, UserRepository and UserContext. Inside the models folder i have a class called User like id, username etc. I ...
-1
votes
1answer
279 views

Is it always better to use __construct() in CodeIgniter's Models and Views, even if it's not needed? [closed]

Sometimes we have Models and Controllers where the function __construct() just doesn't do anything, but is sitting on the top of all the methods in CodeIgniter's models and controllers. A lot of ...
0
votes
1answer
137 views

Webdesign MVC - going in the right direction?

I am trying to learn webdesign using the MVC design pattern. Right now, I am stuck at a point where my code gets more complex, and I am unsure about the structure and where to put which code parts. I ...
12
votes
1answer
316 views

Can domain models in the database be a sustainable solution?

I just started at a new job as a database developer for a medium-small sized, company based on Microsoft-technology. I noticed early on how much practices deviate from what I've been taught at school ...
1
vote
1answer
33 views

Configuration Files For Web Applications

I am building a MVC application. This app has a core which is where all interfaces, abstract classes and operation logic are situated. It also contains a directory called module, this application is ...
1
vote
2answers
161 views

A proper way to work with MVC

I got into a debate at work today, I hope you can help me to settle it up. My colleague wants to separate UI, Model, DB, and Network like so: Create an API level between UI and controller, that ...
2
votes
3answers
379 views

CRUD operations in DDD

I'm designing an application with DDD. I'm moving from flat POCO objects to strong domain models, so my question is: Would I have to call my basic CRUD operations (located in my repository layer) ...
0
votes
1answer
38 views

Confusion over organization of services

I have the following services: UserServices This has various methods: fetch_by_id(), create() etc. SessionServices Session handling: create(), destroy(), various getters. AnswerServices An answer ...
2
votes
1answer
41 views

In MVC framework, where do we define how data are displayed?

I think that the controller should bring the data to view from model. However, is it controller's duty to tell how view should display the data, or the view should know how the data should be ...
4
votes
2answers
430 views

What is NOT MVC? (in a web app)

It is easy to find many descriptions of what MVC is - for instance here, here or in this video. I'm curious, what is NOT MVC? or more precisely - In a MVC-using app, what is everything else apart ...
1
vote
1answer
126 views

Where to put common business logic in DDD with MVC

Providing I have the following scenario: I have a Web application where users can deposit money to their accounts (wire transfer). When a user deposits money to their account, they should click the "...
1
vote
1answer
133 views

The Model or the Controller write data on the view in MVC and what is the use of the Model if we have data in Store?

I've read several articles, watched videos and read questions on here, but the more I read and learn about MVC - including MVCS or MVP in addition.. to make it even worse - the broader the pattern ...
0
votes
0answers
34 views

What happens to super handler with instance variables

What will happen if I extend a class A to a controller B, when A has instance variables (private, protected)? I have a main controller MY_Controller(handler) which has several methods: can_modify (...
2
votes
1answer
318 views

Model-View-Controller design question (One vs. multiple models for multiple view+controller)

I have an issue with shared code in a MVC application. Application controllers/views ABC are different classes but use a common framework. It is a single class reused multiple times. Let me introduce ...
0
votes
0answers
37 views

MVC single view file with multiple uses depending on passed in value

I'm using Laravel with Blade to build a simple maintenance application for my work. One of the functions of the application is to display simple statistics for a piece of machinery. To keep things ...
2
votes
2answers
354 views

What is the role of the public folder in MVC web applications? [closed]

Must all the controllers, models and views be placed in the private folders? If so, what are the roles of the public folder? What are the correct terminologies for such roles in computer science? How ...
1
vote
3answers
188 views

Should I create a class for functions that uses of the database?

I have a PHP application which is pretty simple: It allows the user to create, edit and read a post. Basic stuff. I have a Database class which handles the connection and the queries execution. The ...