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

4
votes
0answers
38 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
59 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
33 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
56 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
20 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
55 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
0answers
423 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, Category page. In the ...
2
votes
1answer
387 views

Controller for repository of members

I am still new to Laravel, just learned the Repository pattern. I tried to implement it on my project, here's the result: MemberController.php -- this one is a bit ...
4
votes
1answer
158 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
37 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
66 views

Controller action to process orders and payments

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

Usage of MVVM in iOS [closed]

I'm an iOS developer and I'm guilty of having Massive View Controllers in my projects so I've been searching for a better way to structure my projects and came across the MVVM (Model-View-ViewModel) ...
2
votes
0answers
41 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
546 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
3k 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
98 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 ...
2
votes
1answer
85 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 ...
12
votes
2answers
382 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
59 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
96 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 ...
10
votes
2answers
3k 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
99 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 ...
2
votes
1answer
49 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
88 views

Is it a classical MVC (Xerox Parc) 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 a simple code to practice/learn the original MVC. Working example View ...
1
vote
1answer
484 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
128 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
58 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 ...
2
votes
3answers
378 views

Controller with too many dependencies?

The main impetus for this review is to determine if my ASP.NET Web API controller has too many dependencies. I'm of the opinion that 3-4 is okay, but 6 seems like too many. I have many controllers ...
8
votes
2answers
7k views

Using a BaseController in MVC asp.net to reuse the repository

I have a repository class that impliments a repository Interface. In my Controllers I want a way to access the repository without creating constructors each time in the controller. So now all my ...
1
vote
1answer
298 views

Inserting using multiple contexts into LocalDB

I've written this ActionResult to model an Order that goes through. I couldn't think of another way to write this without using context ...
0
votes
2answers
267 views

Codeigniter - in the view or in the controller?

Is this correct? Or am I overloading the responsibilities of the view? ...
3
votes
2answers
2k views

Loading content in page via jQuery

I'm doing a web site in CodeIgniter and I'm loading the content page via jQuery, but I don't know if this is a good practice or not. Could I improve it? jQuery: // Another question here: how can I ...
0
votes
1answer
2k views

Doing $_POST the right way

I am not sure if I am correctly handling $_POST data in MVC pattern: Dummy $_POST data ...
2
votes
1answer
228 views

Controller for a MUD client

I want to ensure that, as much as possible given my skill level, that I'm using relevant patterns correctly and following naming conventions. This is a controller for a poor-mans MUD client using ...
2
votes
2answers
122 views

Can I make this admin method in CakePHP more streamlined?

I have a VenuesController and an EventsController. My venues controller has an admin_add ...
10
votes
1answer
3k views

Generic ASP.NET MVC controller that generates many pages

I recently set out to create an open-source ASP.net MVC web development framework. Specifically, I wanted to automate some of the tasks associated with the creation of data-driven applications. I've ...
1
vote
1answer
104 views

Cleanup controller action

I would like some help to clean up this action, especially from @companies and downward. The comments should be enough to explain :) ...
1
vote
1answer
1k views

Router Class In a Lightweight MVC Boilerplate

I'm trying to come up with a simple router class. I considered using a Request class but that will rather make simple to complex. That is why I did not consider creating one for my framework. ...
1
vote
1answer
54 views

Linq to sql performance

I'm creating a system and I'm using EF with Linq. Model First. So I create my Model (.edmx) and using it, I generated my database and my classes. like the Usuario (user in portugues. going to keep ...
0
votes
2answers
189 views

How could I make my controller a little less hideous?

I have a controller. It functions as follows: A user imports a file and decides whether the files contents contain new entries to be placed into a database, or existing entries entries to be updated. ...
1
vote
1answer
98 views

Duplicate SQL code in controller

How I can rewrite or refactor my controller code? I have the same SQL query (@plan_gp_users) in all defs. ...
0
votes
1answer
242 views

Review: Finished router class for custom mini framework

I have finished my router and would like your thoughts on anything that may be inefficient of could be done better!: class Router { ...
7
votes
2answers
132 views

Action based controller using reflections

I'm modeling a reflection-based controller. I would like to know if you agree with my implementation and about what could be enhanced. I'm starting with reflection and I would like to know if I'm ...
4
votes
1answer
401 views

Code structure for a login modal dialog.

I'm using twitter mobile and I have a login-dialog. login-Dialog is a modal dialog. To call it the user calls loginDialog.show(); I'm not all that comfortable ...
4
votes
2answers
9k views

Search and filter in MVC3 Razor using Linq

This code works fine, but I just don't like all the if else. If I keep adding field to filter, it's going to get messy. I am not using EF and cannot on this. ...
4
votes
1answer
152 views

How to improve this design?

I have some design doubts regarding my controllers and I would like some advice... Everything works. However, I'd like to improve it. Basically I have one controller per screen(Swing). I have created ...
1
vote
2answers
85 views

How can I refactor this oversized Ruby method into smaller bits and have unit tests for them?

This is the existing code. Clearly way too much is going on in this index method and furthermore it's untested (and hard to test in its current form). ...
4
votes
2answers
361 views

PHP MVC controller code needs diet?

This is the dashboard controller code in PHP Symfony 2. It collects some aggregate data and points for charts, but i don't like it very much. Do you think that this code belongs to what a controller ...
1
vote
3answers
215 views

Loading data in controllers

I am refactoring my controllers, trying to improve the way common data is loaded for the actions. Initially I was using before_filter methods to do this but read ...
8
votes
4answers
3k views

How would you refactor this if statement of a Rails controller?

I first saw this gigantic if and tried to refactor it. Could only end with a endless switch statement. Old code - ...