Hot answers tagged

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 ...
  • 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 ...
13 votes
Accepted

Currency converter using MVC pattern in C++ & QT

The typical MVC pattern has a data flow like this: ...
  • 92.1k
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 ...
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 ...
  • 110k
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 ...
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 ...
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 ...
  • 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 ...
  • 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 ...
  • 1,765
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 ...
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 ...
  • 5,717
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: ...
  • 2,722
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 ...
  • 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 ...
  • 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 "... ...
  • 6,625
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 ...
6 votes

Action based controller using reflections

I would make some changes to getFirstUpper(): ...
  • 34.8k
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 ...
  • 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 ...
  • 25.2k
6 votes

Solving quadratic equation using quadratic formula

Maybe it's a personal preference, but I find calls like this hard to understand. ...
  • 30.7k
6 votes
Accepted

Is it an anti-pattern to let ViewModel fill itself from a domain object?

It's not an anti pattern. At some point, one layer must know about the layer underneath. You also don't want to rewrite view-model mapping code in multiple controllers or actions, nor do you want to ...
6 votes

Product Manager managing product listings and prices

To help you get started, here's how I would write the Product class ...
6 votes
Accepted

Product Manager managing product listings and prices

if (myMatch.Success) { return true; } return false; That's an awful lot of code for a simple thing. Why not directly return the value? ...
  • 30.7k
6 votes

Baseball player statistics controller

Bearing in mind that you claim that you do not to maintain this code anymore1, there are a few suggestions I would have about this code: define functions and accept parameters- that should allow the ...
6 votes

Factory for report handlers

Not sure if that's going to improve the maintainability index, but You're misimplementing Inversion of Control. IoC is when your dependency (namely, IReportHandler)...
6 votes

ADO.NET database access layer

I suggest using a light-weight ORM called Dapper. Hides all the dirty work by providing extension methods over ADO.NET. Take a look at the examples here: http://dapper-tutorial.net/execute
6 votes
Accepted

Upload and database insert php function

There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton For the life of me I wouldn't think of the ...
6 votes
Accepted

PHP OOP MVC structure

You have a lot of problems in your code, so let's break them down. First, you have a database class that is useless. Add all of your database access config (user, password, host, etc) in ...
6 votes
Accepted

Chess application with GUI and AI in Java

On first glance, I wouldn't call things just View, Controller, and Observable, even if they ...

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