Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Hot answers tagged

14 votes

Markup calculator application using MVC

I scanned through your code and also stepped through it with a debugger, line-by-line. The more I looked, the more things I found that I wanted to point out. Let's start by looking at some ...
user avatar
14 votes

Simple Java MIDI player followup

Well, your post is over a year old, but hopefully this can still be of some use to you! Javadoc No need to say the method name again - the method name is automatically part of the Javadoc. What are ...
user avatar
  • 614
13 votes
Accepted

Order a delicious pie here

First of all I'd like to congratulate you on the HTML part, that one looks clean and takes almost all best practices into consideration. I say 'almost' since ... yeah well ... these days people argue ...
user avatar
13 votes
Accepted

Currency converter using MVC pattern in C++ & QT

The typical MVC pattern has a data flow like this: ...
user avatar
  • 91.5k
12 votes
Accepted

C# Rental Program

Disclaimer: if this answer feels like it gets less patient and more "to-the-point" as it goes on, I'm really tired as I am / was writing this and I can't English / logic right now. I promise I mean ...
user avatar
11 votes
Accepted

MVC controller code

I'm not very familiar with JSP and EL (which isn't very good considering I have an exam on it in a few days), but in general Java terms you can simplify it a lot by moving the separate lists to a <...
user avatar
11 votes

Comparison of PHP/Yii controllers

In addition to the removed duplicated code, the second version has other improvements too. Instead of deeply nested if ($isOk) { ... } blocks, it has flattened the ...
user avatar
  • 107k
10 votes
Accepted

Medical diagnosis selector

Layout Don't hard-code dimensions and positions. On a Mac, everything looks wrong. (I don't have your images, so I'm going to ignore them for the rest of this review.) Furthermore, the user of the ...
user avatar
10 votes
Accepted

PHP Login System with persistent login

Ok, moving down the list... I would separate the content of the includes folder into 2 semantically named folders: includes and ...
user avatar
9 votes
Accepted

Rails controller method that conditionally filters results

Creating a model just to check the parameters is overkill and not idiomatic in Rails. If you need some extra logic, use the existing model. In this case, I'd make ...
user avatar
  • 11.1k
9 votes
Accepted

Solving quadratic equation using quadratic formula

Naming: Names like c, r or s don't mean anything, not to you, not to others. Use meaningful ...
user avatar
  • 5,553
9 votes
Accepted

Simple dice game - JavaScript MVC implementation

MVC thing is hard to be taken right. And yet it is the most popular (my guess) approach in the modern web development. There are different ways to say what MVC means in particular application. I ...
user avatar
  • 1,765
8 votes

Listener/Observer Model in PHP

Because it's a framework static methods are used as my preferred method to access a class from multiple classes without having to worry about creating variables of instances that I either have to ...
user avatar
8 votes
Accepted

PHP Router for MVC

Unfortunately, this is a very large question to ask. So there will be gaps in my answer but i will answer it best i can using code where possible. You do not want to couple your router with the ...
user avatar
8 votes
Accepted

Winform, with a workaround to avoid dependencies

If you start thinking with code, you will almost always end up doing bad things. Why? Because it is not natural. OK, no more preaching and let's get to work. Review of Your Code I apologize for ...
user avatar
7 votes
Accepted

Laravel model and controller interaction

PHP is not my area of expertise, so just some generic notes: 4 is a magic number here: $post = $this->paginate(4); Why is ...
user avatar
  • 29.7k
7 votes
Accepted

Making this site navigation less verbose

First, a few points on case statements. The last three cases all do the same thing. To reduce duplication, you can allow cases to fall through: ...
user avatar
  • 2,722
7 votes
Accepted

Proper way of using the MVC concept - update

I'll skip MVC for now, as I see a whole review for formatting and the such. Perhaps someone else could break down the pattern for you. Right now, let's focus on each individual class. Model ...
user avatar
  • 5,687
7 votes
Accepted

ASP controller for tracking equipment

Index It would appear you primarily do three things here. Sort, Filter, and Page. There's not much to say about your paging, but the sorting and filtering logic clutter the action. Try creating an ...
user avatar
  • 1,960
7 votes
Accepted

Civilization Wars Game

MVC The MVC pattern is described like this: The controller knows the model and the view. The view knows the model. About how components communication with each other: I've seen different opinions on ...
user avatar
  • 1,831
7 votes

Employee Model definition without an ORM

I cannot use an ORM because I'm required to use Stored Procedures Exchanging one for the other (and back again if you like) should not impact the Model design. So the right question is "... ...
user avatar
  • 6,530
6 votes

Is this a good controller?

No I'm not sure why this question is tagged CakePHP but since it is: This is not CakePHP code =). Some specific points to elaborate: session_start, $_SESSION This should not be in any CakePHP ...
user avatar
  • 1,386
6 votes

Action based controller using reflections

I would make some changes to getFirstUpper(): ...
user avatar
  • 34.7k
6 votes

Basic XML template

I'm not that familiar with Play, but overall I can't say that there's anything here I actively dislike. The purpose, layout, variable names and all are quite reasonable and easy to follow. Over all, I ...
user avatar
6 votes

Listener/Observer Model in PHP

I see several problems here: It's hard to understand your code because you have not documented any of the methods and their arguments. I have trouble understanding what's the purpose of ...
user avatar
  • 2,064
6 votes
Accepted

Nested LINQ Nightmare, calculating %completed

Break it down into more methods. StudentTracks has multiple responsibilities, you could extract a private method whose job would be to ...
user avatar
6 votes
Accepted

A hotel greeter named Alfred

From the comments, I guess you would like a theoretical review ;) This: ...
user avatar
  • 32.4k
6 votes
Accepted

Adding friends to address book app

Is it ok that I am setting the properties of the HALContact instance in my view controller? In general, yes. In specific, however, I really don't like the way ...
user avatar
  • 25.2k
6 votes
Accepted

Template engine

There are at least two places in your code where it looks like you wanted to use an object's attributes, but you say $attribute rather than ...
user avatar
  • 3,112
6 votes
Accepted

Retrieving values from UITableViewCell

Let's look at tableView:cellForRowAtIndexPath:. This needs to be abstracted quite a bit more. First of all, CustomTableViewCell ...
user avatar
  • 25.2k

Only top scored, non community-wiki answers of a minimum length are eligible