What makes a good developer?

One Day comes the question, what differentiates the good developer from a really good developer.

At that stage the question is not any more whether you can code or even which language it is you code best. Of course you have a “preferred” language that you know very well, but it should only be a matter of weeks to learn a new language from scratch as the principles are more or less the same in all languages. The same design-patterns apply as well as the same control-structures.

So what makes the difference? Continue reading What makes a good developer?

Valid Syntax errors: Part 1

It took me about an hour to spot a strange behaviour in my PHP skript:

Have a look at this code:

$foo = array ( 'a', 'b', 'c' );
foreach ( $foo as $bar );
    echo $bar . "\n";
// Expected Output:
// a
// b
// c
// Actual Output: 
// c

What happened?

Would I have used phpcs it would have been obvious. I used a semicolon instead of a bracket after the foreach statement.

So instead of calling the echo command with each iteration the foreach silently iterated through $foo and assigned $bar on each iteration. That left $bar with the last value of the array that gave the strange output.

I can not actually remember whether there had been closing brackets but I did not get an Error regarding that.

phpcs would have detected the missing brackets — if that would be observed by the used sniff.

More on phpcs later.