Questions tagged [mvc]
MVC (Model-View-Controller) is a software architecture pattern that enforces separation of concerns.
951
questions
0
votes
0
answers
7
views
Where to add WebApi in a service repo design pattern project?
I am hoping someone has had to do this before and can help.
I have a multi tier MVC application that I need to add WebApi, in preparation for moving to .Net Core + react and a new set of controls for ...
-1
votes
0
answers
98
views
Should logic with multiple SQL executions go in model or controller?
For one of my web application API's POST endpoints, I make updates to multiple tables with separate SQL statements, which all form a single SQL transaction.
Specifically, it inserts some data into a ...
0
votes
0
answers
16
views
An IoT client and MVC-based server. Data model with different fields per type?
The problem
Let's assume such scenario:
List of IoT devices (one model?)
Each list item has (among other fields) a type field
Depending on the value in the type field, device may report different ...
1
vote
1
answer
110
views
Implementing MVC in C++ with minimal boilerplate despite lack of reflection
Powerful reflection capabilities make implementing nice architectural design patterns such as MVC and Dependency Injection very simple in languages like Java and Kotlin. In particular, reflective tags ...
0
votes
2
answers
31
views
Do I use a model or controller in an existing MVC application for implementing an integration that makes API calls?
I have an existing application using Codeigniter Framework (MVC). I need to implement an integration in the software with the external cash register (e.g., making REST API calls). I need to either ...
0
votes
1
answer
66
views
Creating Controllers and Repositories without corresponding Models
I have to create a system to interview people on a few topics where they have to answer both objective and discursive questions, where questions may change between interviews. I structured the ...
-2
votes
1
answer
69
views
what are MVC benefits for my case?
I'm trying to design my new open source project I want to launch.
I want to be very careful with design/projecting because I had trouble maintaining software in the past.
I have code that works and ...
0
votes
3
answers
259
views
What is the difference between these two MVC diagrams?
I want to understand what is the main difference in these two diagrams when it comes to the Model-View-Controller pattern. If there is a difference, how should I choose to construct my program? What ...
0
votes
2
answers
50
views
In which layer request parameter limit should be for an external endpoint?
I have a batch endpoint of the form
POST /entities
["id1", "id2", ...]
Where the endpoint takes an array of ids and returns a batch response.
Now I want to set a maximum value to ...
1
vote
0
answers
65
views
ASP.NET MVC use ViewModels with Services
I'm trying to make a simple Blog-application, but I'm a bit stuck on the architecture of the application.
I'd like to create a details-page with the content of the blog-post and a form for adding ...
5
votes
4
answers
310
views
Does my outer class adhere to the Single Responsibility Principle?
I often write front end apps with a generic MVC pattern. I use javascript but this questions is language independent and relates to OOP as a whole. I struggle to understand the SRP principle and I ...
0
votes
1
answer
315
views
Is this a good example of what a service layer is in MVC?
I am wondering what a service layer is in MVC. I like to understand concepts through a game of monopoly as it's relatable to a lot of people and fairly easy to explain whilst allowing for some good ...
0
votes
2
answers
228
views
How can I achieve polymorphism if MVC logic is on the controller?
First, let me start by saying I’m a JavaScript developer but any conceptual advice I’d imagine is identical if not similar to when dealing with MVC.
During my learning, I stumbled across MVC and now ...
0
votes
1
answer
113
views
How to decide what view to show if I use polymorphism in the Model?
I am making a game of Monopoly. I call a method in my Board class which returns the current players square object! E.g Old Kent Road. Euston, Chance , Free parking. I use polymorphism to decide upon ...
0
votes
1
answer
233
views
Multiple models/controllers python app
I am trying to tinker with the MVC pattern and I have a problem when trying to design the MVC structure. I need a model for products, however as I need to manage more and different data, I can help ...
0
votes
1
answer
50
views
Does it make sense to create seperate data application layers that interact in asp.net mvc?
I work with csv files that after some steps provide the initial data, and with a database that is derived from this data. The database then is read from and written to in many different ways by the ...
0
votes
1
answer
89
views
Benefit of using Dependency Injection inside ASP.NET Core MVC
I am reading this article about using DI inside ASP.NET Core @ https://learn.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-6.0 .. but i can not understand its ...
0
votes
2
answers
453
views
Is MVC a sensible design choice for a CLI application?
I am working on a CLI chess game that only involves 2 human players, I decided to make it follow the MVC architecture to ensure separation of concern and to make the possibility of a GUI/web ...
2
votes
1
answer
99
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
73
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
115
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
339
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
1
answer
428
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
218
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
355
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
622
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
476
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 ...
0
votes
2
answers
1k
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
47
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
vote
2
answers
354
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
82
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
86
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
83
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
68
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
1k
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 ...
5
votes
1
answer
7k
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
3
answers
158
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
2k
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
523
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
273
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
73
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 ...
1
vote
1
answer
467
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
903
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
2k
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 ...
4
votes
2
answers
2k
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
334
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
161
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
350
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
484
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
471
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 ...