Questions tagged [mvc]
MVC (Model-View-Controller) is a software architecture pattern that enforces separation of concerns.
935
questions
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 ....
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 ...
-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 ...
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. (...
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 ...
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 ...
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
...
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 ...
-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 ...
-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 ...
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 ...
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 ...
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
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-...
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 ...
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 ...
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 ...
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
@...
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....
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 [...
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 ...
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 ...
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;
}...
0
votes
1
answer
101
views
Monolithic view model MVC
Currently working on a legacy app. One section deals with generating "reports", each which share some common subsections, that are based on strongly-typed razor partial views. The largest ...
1
vote
3
answers
232
views
Is creating an entity in a database considered to be business logic?
According to my (perhaps incorrect) understanding business logic includes saving/updating entities in the database, as well as connecting with any 3rd party API's or using services and should ...
1
vote
1
answer
258
views
In which layer should I load views on a Clean(ish) architecture?
I am trying to organize my architecture following the clean architecture while using some common practices/frameworks. I'm writing in PHP, but have no problem with other languages. The flow of my app ...
1
vote
2
answers
324
views
Difference Between MVC and MVC + 3 Layered Architecture?
I haven't been able to find a definitive answer online, so I'm hoping that someone with experience can help answer this.
Many MVC tutorials I find online end up using the MVC architectural pattern as ...
-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 ...
4
votes
1
answer
171
views
Do Domain Objects Have To Be Persisted?
Does a domain object have to be persisted, or does this violate some convention about domain objects?
For example, let's say I'm using an object called AuthenticationState to represent authentication ...
1
vote
2
answers
79
views
How to provide error details back to REST request?
In an ASP.NET MVC 4 REST API application, we have SQL errors which are occuring during the request.
However, since the requests are big, we are streaming the data back to the client, which means we ...
1
vote
1
answer
114
views
How does one-way data binding and MVC achieve loose coupling?
In my limited understanding, one-way data binding could happen like the following:
On the back-end, I have a Node backend server. In that, I have a layer that communicates with the database (Model). I ...
3
votes
1
answer
390
views
ASP.NET MVC Caching of ViewModels
My question is regarding caching and ViewModels in ASP.NET (Core) MVC.
I have a service which injects a Repository<T> which is used to fetch domain models from the database. The service layer ...
-3
votes
1
answer
778
views
Comparison of CQRS and MVC
Command Query Responsibility Segregation and Model–view–controller patterns look pretty similar to me.
Are they comparable? Do they act at the same layer of abstraction? How do they differ? Can they ...
2
votes
1
answer
196
views
In an MVC-patterned app, how should one build the interface between model and user interface layers to work nicely with threading?
I am wondering about this. This is a sort of follow-up to my last question here:
In the MVC pattern, what has the responsibility for creating the view?
because now I've run into the question of how to ...
2
votes
1
answer
325
views
In the MVC pattern, what has the responsibility for creating the view?
This is something that has been bugging me for a bit in a program I am trying to build. It is a desktop GUI application, and I settled on the use of the famous "MVC" (Model-View-Controller) ...
1
vote
0
answers
98
views
Rest API backend and React frontend is MVP?
I'm doing a website that has a React frontend that calls some RESTful API and I would like to know if this is an MVP pattern.
I think that the React application implements the View and the Presenter, ...
0
votes
1
answer
65
views
How to inform the controller why the object creation has failed so an appropriate response can be returned?
In my MVC web application the controller calls a service layer which takes any relevant request parameters and builds the model for the view e.g.
Controller
var model = _modelService.Build(id);
return ...
7
votes
4
answers
1k
views
In MVC, is the router considered one part of the controller? Or are they considered separate entities?
I'm learning to implement RESTful APIs, and the concepts of Controller and Router are common in many frameworks, along with the MVC pattern in general, so I'm encountering them everywhere.
From this ...
1
vote
0
answers
66
views
Issues Regarding Data Model Abstraction in Golang
I am currently writing a quiz web-app with a React front-end and a Golang backend, with a PostgreSQL database to keep track of the quizzes, the questions on the quizzes, and the choices in the ...
4
votes
1
answer
209
views
MVC Patterns: Is There a Design Pattern For Returning Lists (Arrays) of Complex Entity Objects?
I’m struggling with how I should build out my entities, services, and DAOs in an MVC web application when it comes to returning a list (array) of data. On one hand, returning an array of entity ...
0
votes
3
answers
212
views
OOD vs MVC; Live Objects vs Everything in Database
How to make memory-efficient code, but still have all the possible code nicely encapsulated ?
I have a feeling that the OO (object oriented) approach is more intuitive and the code is nicely ...
-2
votes
1
answer
63
views
Is there a less complicated alternative to handling this simple mySQL query in Node?
To Put My Question In Better Context...
I am about done writing my first real-world Node application, which would be classified as a REST API. For myself, it was a bit challenging to wrap my head ...
0
votes
2
answers
259
views
MVC who knows about whom?
In the Model-View-Controller pattern, I do understand the role of each component.
The Model represents our application's domain model. The View presents this information and the controller ...