Questions tagged [mvc]

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

Filter by
Sorted by
Tagged with
6 votes
2 answers
594 views

MVC two models required?

I've been doing software for a long time, but almost all of it has been back-end centric. I recently decided to learn Swing and tried to apply MVC principles. I realize that in Swing the View is ...
0 votes
1 answer
794 views

The finer points of HMVC

I'm new to HMVC and whilst tutorials are great about dealing with the overall details of keeping modules separate and only letting controllers communicate, they aren't so great at explaining the ...
2 votes
1 answer
500 views

How can I structure my angular app so that I don't end up with one huge controller and view?

I have an angular app that concentrates most of its functionality around a primary entity that has several satellite entities. The UI for this is effectively one screen, with a few tabs, one for each ...
1 vote
1 answer
296 views

MVC-like architecture: Model-Controller communication of results/status

I'm struggling on designing a solid architecture for my project. In particular, I don't know how to handle the communication between the models and the controllers. My goals are: Following the ...
24 votes
2 answers
11k views

Alternative patterns for web development? (non-MVC) [closed]

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 ...
2 votes
1 answer
80 views

MVC: Should View get strings of GUI components directly or should the controller pass strings to View?

I have an MVC application in Java with GUI components in a View class. The GUI has to support two languages, so texts on buttons etc. depend on which language was set at start up. Strings are in ....
2 votes
1 answer
450 views

How does controller work with view in MVC?

Link says MVC – Model View Controller Let’s look at MVC first. You’ll notice a few things about the diagram: The input is directed at the Controller first, not the view. That input might be coming ...
16 votes
2 answers
776 views

Accessing i18n objects from different scopes

I have been building a personal framework of mine which started off as a way to learn the MVC pattern and has progressed now into something that I like more than most frameworks out there (which is ...
0 votes
1 answer
62 views

I don't understand how to characterize a class similar to a DTO but with validation

I have the entity class. @Entity public class User { @Id @GeneratedValue private long id; private String name; private String lastname; @Column(unique = true) private ...
0 votes
1 answer
64 views

How best to structure my Service/Repository layers when persisting a Many to One object?

I'm working on a project where I need to do CRUD operations on Book and Library objects. Naturally the relationship between Book and Library is Many to One, like so: @Entity @Getter @Setter @...
-1 votes
2 answers
60 views

How to make domain objects accessible to MVC controllers and views?

Summary of my question in a short form: How to propagate changes of domain objects upwards without introducing application logic into them? Following 'facts' are based on prescriptions from respected ...
7 votes
5 answers
4k views

MVC Pattern, ViewModels, Location of conversion

I've been working with ASP.Net MVC for around a year now and have created my applications in the following way. X.Web - MVC Application Contains Controller and Views X.Lib - Contains Data ...
5 votes
2 answers
1k views

Handling common code among presenters

I'm facing some issues related to code duplication when following MVP architectural pattern in an Android project that I'm working with. My project structure is separated by packages: data, domain, ...
0 votes
0 answers
47 views

Spring Boot: Best approach for aggregating DTOs over multiple services

I have the following situation in my spring boot application: I use unidirectional relationship modelling for my database entities, in order to prevent difficulties with a bidirectional approach. (...
1 vote
3 answers
129 views

Should the View pass data inserted from user to Controller or should the Controller get data from View's fields? (MVC Pattern)

My View has a textfield and a button. According to MVC pattern on button click should be called a function of the controller. This function should do some operation on the View's textfield content. It ...
1 vote
0 answers
634 views

How to design the state tree using redux?

In the last days I have searched for a documentation on how and when is it best to use redux and how to design the state tree. My research ended in the conclusion that there is no one correct answer. ...
0 votes
0 answers
111 views

Validation in both controller and my service classes?

I use the Laravel framework. I've got controllers, like CustomerActivityController, and I've got a service layer with services like CustomerActivityService. Say I want to create a new customer ...
-1 votes
1 answer
53 views

MVC for interaction between two models

Maybe a repeated question, so you all could link me if you know an older answer. I'm creating a small web application, using MVC, for a volunteer project that I participate. Right now I'm doing a ...
2 votes
1 answer
916 views

How to do MVC in C++

I have a QT application with a window of OSG written in C++. I want to implement the app using MVC design. The application allows you to add markers to OSG model and it is using QT to edit the markers....
27 votes
6 answers
13k 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 ...
3 votes
0 answers
239 views

MVC vs Layered vs Client-Server

On this book (Software Architecture, 10th Edition by Ian Sommerville, ISBN: 9781292096131), the following architectural patterns are presented (Chapter 6, 6.3, p175): MVC Layered Client-server ...
11 votes
4 answers
7k 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 ...
2 votes
1 answer
188 views

In an MVC Application, What Goes Where?

In an Model-View-Controller (MVC) design pattern, What goes where? What code goes to model and to controller? I know (do I?) that business logic should be define in a model, but a lot of example I ...
-2 votes
1 answer
42 views

Does Angular (or other frontend framework with auto UI update) break Single Source Of Truth since using function within template should be avoid?

I know when building an Angular app (or other frontend framework with auto UI update by change detection), using function in a template is not recommended since it will result in the function being ...
-1 votes
2 answers
193 views

Who is the Observer in MVC? Controller or Views?

Implementing the Observer pattern in MVC could mean making Model Observable and View Observers. However, this also means that there will be direct communication between views and models without the ...
0 votes
0 answers
59 views

Scaling Docker Containers Question with .Net Core Worker Services

I have a fairly what I think is simple question but am completely unfamiliar with design considerations when using docker containers. So I have been trying to come up with a structure for an app that ...
1 vote
2 answers
200 views

Model updating itself in MVC?

My group in school is tasked with creating an application of our own choosing which follows good object oriented design principles. The group has chosen to make a tower defense game with help of ...
0 votes
1 answer
43 views

How best to structure this MVC or Razor Pages web application given a required tcp/ip server data source that acts like a web api?

I am rewriting an old asp.net 4.0 web forms website that exposes an application's data and logic to the web. I am moving this to a .net core mvc or razor page project. The website has minimal ...
0 votes
0 answers
16 views

Consume Identity enabled WebApi in an MVC Project

I have an MVC project with no authentication. The project uses webapi as a backend to retreive and send information through the controllers. Now we need to add authentication to the webapi project as ...
19 votes
4 answers
50k views

MVC and RESTful API service

MVC is pretty straightforward. There is a Model, a Controller and a View. When we create a website, it all come together as 'client sends REST keyword request to server -> the server matches the ...
0 votes
2 answers
52 views

Where to sync Database and Search-Database in MVC pattern

I have a website-sideproject (Application Server: Django, Database: sqlite) with "search" functionality and I've recently stumbled over this problem. When you have a full-text-search-...
78 votes
4 answers
50k views

Is it bad practice that a controller calls a repository instead of a service?

Is it bad practice that a controller calls a repository instead of a service? To explain more: I figure out that in good design controllers call services and services use repositories. But sometimes ...
0 votes
2 answers
1k views

Where to put utility classes in PHP MVC?

I am creating a PHP project using the MVC pattern. You can see the directory structure below. My question: where can I put utility classes like Email and Date? Project directory structure: - app/ - ...
1 vote
2 answers
60 views

How to properly implement Rest Controllers to handle overlapping entities?

I have: A User entity. A Poll entity. Relationship: User creates polls. Use-case: When an arbitrarily user is clicked his/her profile is loaded and shown. The profile includes a list of polls ...
-1 votes
1 answer
38 views

Client side validation with Jquery - MVC C# app

I am working on a very LEGACY MVC App using C# which is built from 2009. They dont have any client side validation at all. In other words, they dont use Validation mechanism provided by MVC framework ...
3 votes
2 answers
640 views

Why do backend web frameworks use "MVC" when they have no persistent UI to update?

Model View Controller (MVC) is focussed on UI based applications. In MVC the model notifies the UI (view) when its values change and the view then decides what and if to update. I can understand this ...
2 votes
2 answers
174 views

MVC: Should my domain model look like this?

Consider the following GUI screen (Java Swing) with a list of persons where the user can select a person and delete it. According to MVC, the view observes (observer pattern) the model and updates ...
3 votes
1 answer
3k views

The right place for "app logic" in MVVM context

I hope this is the right place to ask. I'm an experienced developer, and have used MVC for much time. This question is in the context of iOS/macOS development for the most part, (SwiftUI). Using MVC ...
19 votes
7 answers
8k 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 /...
0 votes
1 answer
119 views

C# Separate Online Store into Different Solutions and Nugets

I am creating an Online Shopping Cart store. It is built through Net MVC Core. There is a Front End View website: html, css, razor. Then we have backend code design for Customers: including shopping ...
9 votes
2 answers
4k views

Decoupling UI code?

In my application I have several event handlers that perform some action in response to user interface events such as a button click or menu selection. The code in these event handlers looks like ...
0 votes
1 answer
305 views

What would the database schema look like for a Entity Component System architecture of web app?

I found previous SE questions like this. I'm familiar with the typical RDBMS backed MVC web app framework. To illustrate what I am thinking of, let's use the examples of Bunny and Carrot from this [...
0 votes
1 answer
46 views

In an MVC desktop application, is there a canonical solution to share an immutable value class between multiple components?

Question In the context of an MVC, desktop architecture, is there a canonical solution or a design pattern / best practice to give access to an immutable value class to multiple components at ...
0 votes
1 answer
178 views

MVC architecture - communication between nested components

I'm working on a rich client desktop application. I'm trying to use MVC to decouple the model, view and controller responsabilities. Problem is I can't seem to find a clean solution for handling ...
3 votes
3 answers
324 views

RESTful endpoints for returning same model based on different fields?

What is the recommended convention to be followed for identifying different GET endpoints that fetch the same model/entity using different fields/parameters? For example, there is a Student entity for ...
1 vote
2 answers
836 views

Should a single method in a service class perform multiple operations for its controller?

Let's say I have a controller called MessageReceiverController which is a controller of an API that other services can call and include messages in the requests. For each of the messages the ...
3 votes
2 answers
880 views

Clean Architecture, how does the use case interactor generate different outputs?

I'm trying to understand how do controller and presenters work in clean architecture projects and could use some help. Specifically about generating multiple outputs from the use case. In the Clean ...
17 votes
3 answers
21k views

Model-View-Controller: Does the user interact with the View or with the Controller?

I have recently learned about the MVC design pattern. I'm learning from the Head First Design Pattern book. According to this book (if I understand correctly): The Model is most of the application ...
-1 votes
1 answer
99 views

Is State Considered Part of Model In Desktop MVC?

Most of the answers I see that discuss what the model layer is comprised of, only address stateless MVC, particularly ASP.NET's implementation of it. When working with desktop MVC frameworks such as ...
3 votes
1 answer
212 views

DRY principle vs decoupling (business from GUI)

Say I have a business model called Vehicle. Vehicle has many fields but to keep it simple say it looks like: public class Vehicle { String ownerName; String brand; FuelType fuelType; }...

1
2 3 4 5
19