Quote Originally Posted by Dr Livingston
This part still could be refactored as SWITCH is a bad code smell
You might be able to get off with something like this:

PHP Code:
class FrontController

$commands = array(
'add'  => 'UserAddCommand',
'edit' => 'UserEditCommand',
'list' => 'UserListCommand'
$command = new $this->commands[$page];

$view $command->getView();

The bad smell for me was the repitition of "$command = ...; break;". Much better to replace that with a simple "return" imo. ("$this->" is also very ugly imo, and is the thing I like the least about PHP.)

I get the feeling that there is lots of over-engeneering going on, when simpler solutions would work. Look at the number of Java projects out there at the moment going under the "better than J2EE" banner. (It is interesting watching the arguments between the hardcore Java croud and the Rails people!)

I'd much rather do these things like this:

Happy coding peiople,