Questions tagged [mvc]
MVC (Model-View-Controller) is a software architecture pattern that enforces separation of concerns.
935
questions
2
votes
1
answer
906
views
MVC with PyQt - How to reduce data queries by the View from Model?
I'm currently developing a Python program with a GUI based on Qt 5. I use a MVC template I found on Github.
Let's assume that a single check box was checked or unchecked and the model was updated. ...
2
votes
2
answers
4k
views
JavaFx : Is there difference between String and StringProperty in Model Classes?
I'm trying to follow MVC concepts when i develop my application ,but I'm confused between Using String or StringProperty in Model classes.
Example one :
public class User{
String name;
...
2
votes
1
answer
175
views
Should the Service interface not extend the DAO?
I'm writing the service layer for my DAO and I've made it extend the DAO interface. It looks a bit like this:
public interface FooDAO {
Foo get(long id);
boolean update(Foo foo);
These two ...
2
votes
1
answer
2k
views
Data sync between Model and View in MVC pattern
I have a question about MVC pattern, concerning the controller part.
Most of the program I happen to write are basically spreadsheet like. They are written in C/GTK+ and Python3/Qt5/Tkinter but share ...
1
vote
1
answer
1k
views
What alternative name to give to controllers?
There are several posts and other contents in the internet that claims against naming classes ending with "er" (like manager, controller, helper...). I personally agree with that, but what ...
0
votes
1
answer
469
views
Anonymous Controller/Action within Authorized Site
Say I have an MVC .net core website where 100% of the controllers/methods are behind [Authorize] attributes (complete with policies and all).
Would it be taboo, to carve out a set of un-authorized/...
2
votes
2
answers
5k
views
What is data persistence in the context of software engineering?
I imagine it is simply, as it is named, the existence of data throughout layers of a software application. I ask because I have not been able to find a clear definition that states something of the ...
4
votes
1
answer
3k
views
How to update the view when the model changes?
Since I'm learning the MVC pattern, this might be a very naive question.
I know that when something happens on the view (e.g. user clicks a button), the view calls the controller which in turn ...
3
votes
3
answers
1k
views
Should I always use the MVC pattern (or similar) for big, graphical and professional applications?
If I write an application and decide to develop only a single graphical interface for it, and never intend to develop multiple GUIs, then by today's standards it is okay not to use the MVC pattern or ...
-1
votes
1
answer
125
views
Should we implement the state machine logic near the data in the "persistence" layer, or bring the data out and implement it in the "listener" layer?
The implementation is MVC. The View is isolated to the browser layer. The Model is isolated to the persistence layer. The Controller is split with: UI controls in the browser mostly so input is ...
3
votes
1
answer
240
views
Is a high atomicity in mvc overkill?
As time passed by I learned that not strictly following the rules of a architectural pattern like mvc kind of counteracts the actual purpose of having a maintable software. Usually I end up with fat ...
0
votes
1
answer
88
views
Where should I generate response for api?
I have multiple Models(Models in MVC), These models are injected into repositories and repositories are injected into Controllers. I need to create an api for several endpoints. The responses for ...
0
votes
1
answer
70
views
MVC: Better Use Custom Getter or Repository Function
I am using PHP with Symfony and Doctrine but my question should be independent from any used language or framework.
Suppose you have an entity Product with a One-To-Many relationship to another ...
10
votes
2
answers
13k
views
Proper design to avoid the use of dynamic_cast?
After doing some researches I can not seem to find a simple example resolving a problem I encounter often.
Let's say I want to create a little application where I can create Squares, Circles, and ...
1
vote
2
answers
160
views
Bundling Model and Services in MVC pattern?
These days, all I hear is how MVC should contain additional layer called services, turning it into SMVC. But to me, it seems like too much of a decoupling and instead want to engineer my app something ...
-1
votes
1
answer
208
views
Java MVC or Rest based approach with security [closed]
I am working in designing Java-based web applications. Although, I have worked with Java core still a novice in designing web-apps and do not have enough confidence in what I am thinking is correct or ...
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, ...
3
votes
1
answer
141
views
Should the presenter access view data via properties or event parameters?
I have a new-employee form.
When the "Save" button is pressed, a SavingRequested event is raised. The Presenter gets an Employee object from the View and passes it to the Model for further processing....
0
votes
2
answers
238
views
Is it acceptable to break MVC by storing data in the DOM in order to reduce load on the Database Server, ever?
I am currently using NodeJS & Express to load webpages which contain element content that is rendered via a query to MongoDB.
A GET request will create Button elements, binding the MongoDB _id ...
4
votes
1
answer
537
views
Should a Controller have a Model object as an attribute?
For context, this project is a personal budget program I am working on while I try to learn to use MVC patterns effectively.
There is a SessionController that passes user commands to a ...
6
votes
2
answers
2k
views
How to deal with too many interfaces
I am looking at updating some of my companies existing code to allow unit tests to be implemented. To be able to do this, all repositories are being interfaced to allow DI. However, the existing ...
9
votes
1
answer
559
views
Patterns are not building blocks – so I shouldn't build an app on MVC/MVP patterns?
I've read this page about design patterns, and how you should treat them when writing your code. From my understanding, as the title in the link states:
Patterns are not building blocks.
If I ...
-6
votes
1
answer
548
views
Microsoft Entity Framework - when to use it? [closed]
I am researching Microsoft entity framework and I am confused about when it should or should not be used. I am interested in the relationship between entity framework and product management ...
0
votes
1
answer
3k
views
When to have more than one controller class?
Would it be correct to assume that in general, I would need as many controller classes as classes that can be accessed/modified by a user?
For example, If a logged-in user can add/modify to a class ...
-2
votes
1
answer
176
views
What's the best possible architecture for a small web application using MVC? [closed]
I need to create a web application that will use MVC. The application is small, and will only use one web page. It will retrieve information from a database, as well as add and update entries onto it. ...
1
vote
1
answer
2k
views
Command Line Interface MVC Architecture
I just learned about the MVC architecture. I was going back and working on a command line file transfer application I wrote, and I was curious, to what degree should command line interfaces follow the ...
2
votes
2
answers
6k
views
How should the model notify changes to the controller in the MVC paradigm?
I was reading about code architecture and the MVC/MVVP paradigm. Ideally, we should have the model as a high-level policy/component where it should not know or directly depend on other components, ...
0
votes
1
answer
181
views
BLL Layer with physical file path
So I am working on an existing website project that has a BLL layer with some functions that use physical file paths.
But now I am creating a console app that will be setup as a windows scheduled ...
5
votes
1
answer
262
views
Model "Clones" Adding Complexity to N-Tier MVC Project?
I was discussing a project structure of mine with a friend and he pointed out an interesting point about how my architecture seems to introduce complexity and over abstraction into my layers by having ...
2
votes
1
answer
676
views
MVC - Getting data from the model to my view
I am currently developing an SFML application which stores a certain value in my model, which the view is displaying.
As SFML operates on a kind of render loop, which refreshes the interface ...
3
votes
2
answers
628
views
How do you break down the User Interface layer (MVC) so that multiple teams can work on it?
I am trying to break down a large application so that multiple teams can work on it. I have created a number of Bounded Contexts for the domain layer. Each bounded context is contained in its own ...
3
votes
1
answer
330
views
Writing decision statement on controller layer
We are developing a REST application based on an MVC architecture.
The service layer is returning Optional<T> where T could be any class.
So on the controller layer there is a conditional ...
1
vote
1
answer
715
views
PHP Application - code structure in practice(3-Tier)?
I should preface this by saying that although I've been programming for a while, this is the first time I'm doing it for work and am relatively new to PHP.
I have been asked to create a PHP app that, ...
2
votes
1
answer
59
views
Where to implement URL data validation in Node/Express?
I'm building a RESTful API using Node/Express4 and so far I've been successful. However, I'm not sure where to implement URL data validation - should the router script block invalid URI requests or ...
1
vote
0
answers
519
views
Moving Role CRUD operations from the Controller to the Application Service
I am creating an administration facility for an asp.net MVC application. I am currently trying to create a form that will allow admin users to create roles. I see plenty of code, which looks like ...
1
vote
0
answers
237
views
GUI that builds an object - how to design the GUI?
I'm currently writing the GUI for my application. As I understand in a MVC-like application are the following components for each feature:
Business data: a complex object hierarchy containing all the ...
-2
votes
1
answer
2k
views
How do I use the same entities in multiple projects with the entity framework?
I have to create two different projects with the Entity Framework:
Web API Services
UI and Business Logic (MVC).
Both the projects have to work with same POCO entities. I see two alternatives and ...
1
vote
2
answers
1k
views
What other approaches are there to break circular dependency in MVC?
I'm attempting to build a web front-end based on the MVC pattern, as opposed to based on the libraries involved (e.g. React.js).
I'm using constructor-based dependency injection and interfaces to de-...
0
votes
2
answers
678
views
If model in MVC serves multiple purposes (views), should it be split to multiple models?
In MVC (I'm using Spring, although it's not relevant to the discussion) I have a following model:
public class User {
private Long userId;
private String username;
private String password;...
1
vote
1
answer
211
views
How to modelize items in a shop (like LoL, Dota, ...) the MVC way?
In a 2D game, buildings can be upgraded with modules; Those modules can be bought in a shop.
The shop is represented by a stereotyped grid of icons, each icon representing a buyable module. When the ...
-1
votes
1
answer
381
views
Recommended practices to use PDO with MVC model [closed]
I am experienced with OOP but I am just starting to use the MVC model.
I would like to know what are the recommended practices to use PDO within the model and still keep a high level of abstraction.
...
1
vote
2
answers
170
views
Why do frameworks give more flexibility to models than controllers?
I've always tried to keep models for direct database interaction only, and keep all the actual logic in the controllers. Usually, a framework or platform provides more flexibility to models and limits ...
1
vote
1
answer
696
views
How to manage when different user roles need to access to a same model in MVC
I'm learning how to work with the MVC pattern, using Laravel, but I have a question. This is an example case, there is a User model and the user can register by itself or an admin can create a new ...
0
votes
1
answer
404
views
Specifying concrete type of ActionResult
There are loads of types implementing ActionResult like ViewResult, PartialViewResult, JsonResult, RedirectResult and so on. I have seen two approaches when creating action methods, either always use ...
1
vote
1
answer
577
views
What level of unit testing in a controller that simply calls ViewFactory to get Model
I have implemented a ViewFactory to seperate the generation of View Models from the Controller logic. The ViewFactory implementation has a comprenhensive set of unit tests that cover all paths.
As ...
0
votes
1
answer
514
views
How to design an Excel export class in MVC?
I have a pretty badly designed system on my hands right now written in ASP.NET MVC.
It does have a lot of logic implemented inside controllers without any outside models with business logic. I would ...
-1
votes
2
answers
730
views
Interaction between model and self-modifying data in Qt MV
I have a tree structure that represents a system of devices that are connected to the PC via serial port. In a way, this structure was inspired by tree model example in Qt and I think that helps to ...
0
votes
1
answer
239
views
Encapsulated views in MVC
This is an architectural / design question that just came to my mind when comparing current MVC practices in PHP with component based development in Javascript.
My question is:
Why doesn't the view ...
2
votes
3
answers
1k
views
What models do I have? And what's a layer?
I've gone through a few tutorials in ASP.NET Core MVC, and I've built a little app (for looking at problems in old exams) that looks roughly like this:
Solution
Project
...
Models
...
0
votes
2
answers
2k
views
Android MVC with the Activity being the controller?
In an android project, I don't see how the following architecture can be considered MVC.
The team said:
Android apps are fundamentally MVC
the Controller is the Android Activity.
the MVC View is ...