Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [controller]

The controller tag is used with questions involving the controller component of the Model View Controller (MVC) design pattern. The controller component accepts input, usually from a user interface, and issues various change and modification requests to the model component and/or the view component controlling the data of the model and how the data is presented. In some cases controller and view are combined into a single component.

Filter by
Sorted by
Tagged with
1 vote
2 answers
106 views

Entities can move from one Clean Architecture use case to another using the controller?

I'm working on a project with the task of creating a route to checkout ticket purchases for events. In this scenario, I have a controller that receives the request with order data, client information, ...
Victor Antunes B.'s user avatar
0 votes
2 answers
115 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 ...
objecttothis's user avatar
2 votes
4 answers
762 views

Can the presenter talk to to the controller?

in the clear architecture, what uncle bob suggested. I have a lot of questions about how to correctly distribute the responsibility. it seems that there is no relationship between controller and ...
rahul  Kushwaha's user avatar
0 votes
0 answers
190 views

Is Controller a special kind of Indirection in GRASP Design pattern?

This is Indirection according to Wikipedia Assign the responsibility to an intermediate object to mediate between other components or services so that they are not directly coupled. Controller seems ...
Yahya Fati's user avatar
1 vote
2 answers
111 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 ...
Julian Broudy's user avatar
-1 votes
2 answers
455 views

PHP Design Pattern, separation of concerns: should the Controller make a new HTTP request to the API?

I'm having a huge doubt on how to connect the front-end of my application to its back-end. So my application has a single entry point where all requests go. The request is dispatched to a controller, ...
yes sure's user avatar
2 votes
2 answers
3k 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 ...
xenon's user avatar
  • 887
7 votes
1 answer
3k views

Clean Architecture - Controllers and Presenters

I am having a hard time trying to wrap my head around the relationship between Controllers and Presenters in Uncle Bob's Clean Architecture. In most of his videos, he talks too little about ...
Tacca's user avatar
  • 111
3 votes
3 answers
800 views

Does the Controller contain get methods in MVC?

I am at the stage of implementing a my 1st ever view, after developing a Model and Controller, however there is a problem. I have been reading this article on MVC, which is what I have been aiming ...
Scott Anderson's user avatar
9 votes
4 answers
3k views

Should access control be implemented in controller or repository layer?

I've got a project with an HTTP API which returns data from a database. The layers it goes through to get to the API look like this: DB -> Repository -> Controller I'm looking to restrict the ...
Joundill's user avatar
  • 149
8 votes
2 answers
1k views

Separation of concerns and other best practices across Controllers, Services, Providers and Stores in ASP.NET when building a REST web api

I am traditionally a desktop app developer, but circumstance has thrust me into the role of doing web client and corresponding REST api logic for a project I am involved in. Unfortunately, I'm a one-...
Geo...'s user avatar
  • 181
-1 votes
1 answer
244 views

Display different panel on button click (MVC pattern)

I have to code a gui like this: It's an homepage with a left menu and a changing right part, on button1 click form1 must be displayed, on button2 click form2 a so on. Each form has its own button "ok"...
Diablo3000's user avatar
0 votes
1 answer
100 views

Is my typescript controller overloaded?

I'm building a rest API using typescript and typeorm as orm. Each route of my API point's to a specific method located in a controller class. My question is about the content of this controller ...
Markus's user avatar
  • 103
1 vote
1 answer
248 views

Controller class for an input dialog

I am learning OOP, concretely Java, by developing a real life business application for aimed for repair shops. I have followed MVC pattern design for GUI elements of my application. I was wondering do ...
Zoran Jankov's user avatar
0 votes
2 answers
2k views

How to avoid duplicate code in two similar MVC controllers

I have two panels, one for the admins and the other for partners. And there are two OrderController with Admin\OrderController and Partner\OrderController namespaces. They both look very similar. ...
Pouneh's user avatar
  • 11
1 vote
1 answer
687 views

Where do JavaFX FXML controllers belong in an ECB architictural design pattern?

I am wondering where does the fxml controller belong in the Entity-Control-Boundary model? When designing a JavaFX application with the help of Scene Builder, Scene Builder generates an fxml file ...
Julian Broudy's user avatar
0 votes
1 answer
57 views

What's the best approach to write chronology entries on certain actions in ASP.NET Core MVC?

I'm working on a software product that entails users opening up a case and taking actions to process the case, changing the status, creating tasks, etc. I'd like to provide a history of the actions ...
Hunter Nelson's user avatar
0 votes
1 answer
441 views

How to design thread safe class when separating business logic from POCOs

I like to separate business logic out of POCOs into controllers. If an object must be thread safe, where do I put the lock code? In the POCO itself? Or in a controller? Might make sense because ...
Hoppe's user avatar
  • 101
2 votes
0 answers
172 views

Packages, a controller class, and coupling vs cohesion

So I'm building my first application, in Python, and some issues have cropped up because of the lack of interfaces (I.e. explicit type declaration) My design involves several homebrew packages, and I'...
user309290's user avatar
0 votes
1 answer
1k views

Controller and API DTO Architecture and class organization in .net core with microservices

We are developing a system with coarse microservice architecture. We have an API that uses controllers and back-end logic with Entity-Framework repository, and several types of clients that use this ...
Yamuk's user avatar
  • 141
0 votes
1 answer
2k views

Is it possible to add Service layer in MVC pattern?

I'm working on javaFX project using Hibernate and H2 database,I'm trying follow the concept of MVC design pattern ,so I have created 3 packages : models :contains POJO classes 2.1 views.fxml:...
Menai Ala Eddine - Aladdin's user avatar
1 vote
1 answer
2k 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 ...
Talysson's user avatar
  • 157
2 votes
1 answer
216 views

Spring Restful API - Controller strategy

We are developing a new REST Api for our Spring MVC legacy enterprise web application (before this it was communicationg with Adobe Flex frontends). As a general rule we stated that we were creating ...
frankieta's user avatar
  • 121
4 votes
1 answer
1k 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 ...
g_sue's user avatar
  • 49
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 ...
sly-gdk's user avatar
  • 13
1 vote
2 answers
726 views

MVC: how to design interface for database

I'm a newbie on web development and I've heard about MVC. If I'm right, it's the Controller that take charge of fetching data from DB. So I have a question: In the pattern MVC, how many objects to ...
Yves's user avatar
  • 193
1 vote
1 answer
214 views

Inversion of control in controller by a mediator

A user has to perform a somewhat complex task on my website (submitting a rating). For the sake of example, let's consider it's a rating for a movie, done through a controller. There are several ...
Cyril Duchon-Doris's user avatar
0 votes
2 answers
365 views

Abstraction from database - handling ID types

I am using MongoDB in a project, where relationships between collections are created via referencing a unique document ID of a special BSON ObjectID type. So I can have a School document like this: {...
Tony Sepia's user avatar
15 votes
1 answer
41k views

Controller calling multiple services

I have a few layers in my WebApplication: Presentation, Service, DAO, Domain. Services call DAO objects which reads data from a Database/File whatever. I have a Controller that needs to fetch data ...
Diyarbakir's user avatar
5 votes
3 answers
3k 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) { ...
imel96's user avatar
  • 3,518
3 votes
1 answer
152 views

where to put methods that manipulate objects

I have a controller method as follow: public class RoomsController { @RequestMapping(method = RequestMethod.GET, path="/v1/rooms/{name}") public ResponseEntity<?> getRoomInformation(@...
Luiz E.'s user avatar
  • 133
6 votes
2 answers
6k views

Should controller layer create model objects or they should be created by service layer?

I have a small application with classic layers Controller-Service-Dao. Controller actually is REST resource, which deals with JSON data. And the questions are: 1. where is the best place to create ...
sphinks's user avatar
  • 169
1 vote
1 answer
60 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(){ ...
danielr1996's user avatar
2 votes
2 answers
5k views

writing a controller file in Python

I need some advice on my idea to write a controller file in Python, and not like the C in MVC type controller but a more simpler idea. Just a Python script that controls the operation of some other ...
jonathan's user avatar
  • 129
0 votes
2 answers
549 views

In AngularJS - should $resource be used from controller or service?

All the documentation, examples and tutorials I've found on $resource were using it directly in the controller. So far I'm just using $http from services and those services are further used in the ...
peter's user avatar
  • 113
0 votes
1 answer
282 views

PHP MVC concept large controller

I have custom MVC framework in PHP and my controller file has about 5000 lines. The question is, is it a big concept flaw? It is structured code with kiss method and quite maintainable. Are there ...
JTC's user avatar
  • 145