In MVC architecture (Model-View-Controller), the object responsible for passing and receiving data to and from views, acting as a bridge between the "Model" and the "View".

learn more… | top users | synonyms

1
vote
1answer
29 views

Angular Box Color Exercise

I have completed an exercise where there are 4 different color boxes and 1 main box below them that is blank, when you click on one of the colored boxes, the main box changes to the color of the box ...
5
votes
1answer
81 views

Sails.js controller method for an admin to update a user account

I am new to Sails.js, Node.js, and web application development in general. My current understanding is that well-written controllers should be "skinny" meaning they should be as simple as possible, ...
3
votes
1answer
26 views

CakePHP static pages (without entity) but with dynamic content

I have a few pages that is not connected with entities (index page, terms of use page, email page). Detailed description: In CakePHP, when you want to have a static page (such as index for example), ...
2
votes
0answers
53 views

Controller method to add a product, stored across three database tables

I have some questions on how I can improve this "add" action method in a controller. Using a single form, the user can upload a product to be displayed on the site. A Product is composed of three ...
4
votes
1answer
73 views

CakePHP change 'miniMap' action and respect template

I have some questions on how I can improve this "action" (method) in "controller": My template has a navbar with dynamic content (if the user is logged in a special button appears, his name appears ...
1
vote
1answer
89 views

Price calculator for motors and pumps

Note This question was born in request to post more details from this question on Programmers. Since details may uncover new/different complexity, I'm asking another question here. I also will use ...
3
votes
1answer
36 views

Controllers for interacting with a vacation service

I have a controller called VacationController; in this controller, I retrieve a list of vacations which will be displayed in a grid. In the grid, I have the option to create a new vacation through a ...
2
votes
1answer
35 views

Handling success and failure when retrieving product information

I've got an Angular controller where I have two functions that are repeated inside two functions: ...
1
vote
1answer
64 views

Monkey patch allowing virtual controller methods in PHP MVC application

I'm in the process of building a soon to be opensource CMS. 100% MVC. The basic idea is that a plugin should be able to add pages (read: methods) to a given controller, without needing to instantiate ...
0
votes
0answers
118 views

Laravel 5 Search

I think I could improve this code a lot, especially this part: if($month !== "") { AppointmentsController: ...
2
votes
0answers
68 views

Business logic in controller

Led by the recently read premise "Lean controllers and fat models" I've come to the conclusion that my controller might be too fat at the moment. Basically, what I'm trying to achieve is simple Edit ...
2
votes
2answers
51 views

Controller method to validate and save

I have built RESTful web services. The services endpoints have a similar logic: If the input validation succeeds, do a database operation and return the result. If the db operation fails, return the ...
2
votes
1answer
87 views

AngularJS to-do list controller

I am new to Angular. Am I following best practices here? I understand controllers should not do too much. My controller seems to have a lot of logic here. Can I do anything to improve it? It is just a ...
1
vote
1answer
37 views

Selecting orders submitted by a user, segregated by status

I have recently started using Laravel as my chosen framework. It is my first time using a framework. As I have made progress through my project, my controller methods have started to increase in size. ...
0
votes
1answer
168 views

Laravel Controller including sort and search

I am using this code on my own personal website (my personal administration site) so it doesn't need any security and so on. I am not into learning everything about that yet, and although I do know a ...
2
votes
0answers
140 views

Interactive transition between view controllers

I have made an interactive transition controller in Swift in two different ways. This interactive transition controller is the parent class and I have few child classes which adapt the parent for ...
2
votes
2answers
75 views

Move code from controller to model

I'm working a rails application that has a lot of logic in the controller that should be in the model. In the app/controllers/customers_controller.rb#create there ...
1
vote
2answers
72 views

Replacing an application service class with multiple command handlers

I have a Controller which uses an application service to accomplish its tasks. The service class is starting to grow big and developing multiple dependencies. So I am thinking of replacing the single ...
3
votes
1answer
44 views

Django view and template for a virtual zoo

I have a Django view and template that work together, but I think I probably did things in a crappy way. I basically have many dynamic values that I want to display on the page, and in two different ...
1
vote
1answer
83 views

eCommerce web appliation

I am making an eCommerce web application using the Laravel 5 framework. I have created a Categories controller for the administrator and with the following actions ...
6
votes
2answers
97 views

Controller for classrooms and students

The actions I'm wondering about are members, add_student, and remove_student. They work ...
0
votes
1answer
31 views

updateBuildChart method with a lot of dependencies

I've some refactoring issue with one method. This method has a lot of dependencies ...
1
vote
1answer
84 views

Adapting new design pattern with post handler

I'm currently using this pattern in my JavaScript code. Somewhere in my code I use Dnianas.Post.init. init fires and it will ...
5
votes
1answer
62 views

Is my blog controller too “Fat”?

I would like some advice which relates to the "fat model skinny controller" concept in Rails. See my show action in the Micropost controller ...
5
votes
1answer
138 views

Controller to manage athletes

I would appreciate if you could give me some advice about the code below. I am a student learning PHP programming and programming fundamentals. I have learned a lot from Stack Overflow but there are ...
2
votes
1answer
192 views

Web API controller to get details of a travel plan or a leave request

My web API has 3 controllers for get, post and users CRUD. I named it as DetailsControllor, FormControllor and ...
2
votes
0answers
51 views

Sports statistics controller

Is there too much logic in this controller (should I migrate them to the model)? How else can it be refactored? ...
1
vote
1answer
122 views

Handling callbacks when doing async programming and dealing with scope

I'm using HapiJS to create a little backend for my side-project. In grabbing RSS feeds, I want to loop through my list of website URLs, grab the correct RSS links in the ...
1
vote
0answers
52 views

Persisting database row ID between controller actions on a multi-step “create item” form

I have a form on an anonymous site which has 3 steps. A user submits each step individually, in sequence (1-2-3). BUT, step 1 creates a new table row, while steps 2 and 3 only update the existing row ...
3
votes
1answer
76 views

Using one service ($http) on all the controllers

I have recently started working on angular.js and I like it. I have decided to use a single controller per view. I use the json data from the backend. As my work is progressing, my codes are getting ...
1
vote
1answer
2k views

Shopping cart application in Spring MVC

I am creating a shopping cart application to learn Spring MVC. I want to display a list of all categories and subcategories in more than one page. i.e; Home Page, Products page, and Category page. In ...
2
votes
1answer
413 views

Controller for repository of members

I tried to implement the Repository pattern for my project: MemberController.php -- this one is a bit too long and has repetitive code ...
5
votes
1answer
381 views

AngularJS trivia game - separating controller from directive

I am creating a trivia game (purely for learning purposes) using AngularJS, NodeJS and MongoDB. My concern is related to the way I am organising the code in AngularJS. So far the game is functional, ...
1
vote
0answers
51 views

Newsfeed app for allowing custom Reddit feeds

I'm currently working on a newsfeed app (see it live here or its files on GitHub) that lets a user create a custom Reddit feed. The user adds the subreddits they'd like to view, and then can view them ...
7
votes
1answer
78 views

Controller action to process orders and payments

I'm trying to reduce the if statements and simplify this create action. ...
2
votes
0answers
43 views

Is my controller for editing information about videos doing too much?

My project uses Zend Framework 2. I'm trying to determine if I am doing too much in my controller as a rule for my development. I have built my controllers like this for a while and haven't run into ...
5
votes
2answers
1k views

Rails controller method that conditionally filters results

This code for my blog checks to see if tags are in the params hash. If they are, then only posts that are tagged will be paginated. Otherwise, all of the posts are paginated. ...
3
votes
1answer
12k views

Developing an alert notification in AngularJS

I'm studying Angular and want to develop my own notification alert. This is what I done, I like it and it's working like a charm but I think that it can be improved: Do I need to use it in ...
2
votes
1answer
109 views

Any improvements for my LoginController class?

This is probably going to be my final question regarding controllers. I feel like I have a good enough understanding of them now and am able to write them cleanly. I've recently adapted a less error ...
3
votes
1answer
177 views

Controller code using the koa framework

I would like to gather ideas on how to refactor the JavaScript/NodeJS controller code below to be more aesthetic. The code is using the koa framework thus I use ...
13
votes
2answers
418 views

My final sign up controller

I've asked a couple of questions here before regarding my controller, but I think I've finally gotten to understand controllers completely, but I'll never be sure unless I get my code reviewed. I've ...
4
votes
1answer
70 views

Is this approach correct when testing an Angular controller?

I'd like someone to review these tests to make sure I'm along the right lines in Angular testing. Note - They do all pass (great) but I feel like I'm struggling to understand the finer points of ...
3
votes
2answers
99 views

Controller: Sign up action clean up

I don't know if it's just me, but I feel like my sign up action method has gotten a bit messy. I think that perhaps instead of setting error messages in a controller, I should set error codes which I ...
13
votes
2answers
5k views

AngularJS Todo List - too much controller logic?

I am starting an angular app and I was wondering if I am on the right track with this. I worked on my last angular app when I was just a youngun who didn't understand the important of designing the ...
6
votes
1answer
110 views

Uploading file for related entity

I see that my code smells. The first file is a controller, and createAction. But I don't know where to delegate this. BookController.php - Whole controller class So this is most 'smelly' code to ...
1
vote
1answer
84 views

.ASP controller code

I've tried to create application with MVC N-layer pattern. I asked my buddy for a shot review, and he said, "You should separate logic from controller". But my controller only work as a ...
3
votes
2answers
105 views

Xerox Parc MVC implementation

I've been trying to understand the original MVC implementation (the Xerox Parc's one). I'm sure it has flaws, but it's simple code to practice/learn the original MVC. Working example View ...
1
vote
1answer
1k views

CodeIgniter maintain data through Controllers

I have a main menu in my application. It loads depending on the role of the user that I validate from a table in my data base, but I have to recreate this menu every time I call a new controller. ...
3
votes
1answer
143 views

What can I do better in this ViewModel Creator?

I'm currently creating a ASP.NET MVC page in C#. I want to hide everything regarding the creation of our "models" and "viewmodels". I have seen much of the fancy stuff regarding Dependency ...
0
votes
1answer
103 views

Is it reasonable to have separate controller actions for different user registration paths? Or should I refactor into a fewer number of actions?

I have two registration paths in my app. They are very similar and I am curious if I should simplify 4 associated actions down into two actions that handle the same amount of work. Here are my ...