The importance of developing in a good environment

No, I’m not talking about that strange smell in your room.

This is a story that happened to me a while ago. It was certainly my fault, I could be more cautious, but in the end the net result was positive.

First job, first delivery, first meeting to check my work.
Imagine: I was awake all night studying the codebase in every detail, fixing all the warnings.
Refactoring, test, comments: you name it. I wanted to show that I was working good.

I arrived in time, turned on the PC to show off my work.
“No, let’s try it directly on the server!” – my boss said – “Have you updated the database?”
“Yes, I’ve added the necessary fields. Here’s the dump.”

Brilliant! Impeccable!

I upload the application. “Well, let’s try to add a record…” BAAAM.
A dreadful white screen with this error:

syntax error, unexpected T_OBJECT_OPERATOR in File.php on line 68

Panic. Alarm. Alarm. It couldn’t be. Obviously, it works on my machine.
I checked row 68, there was only a simple query:

$var = $DB->Execute($sqlQuery)->FetchRow();

What could be wrong with this row? I didn’t touch anything. A simple method chaining. Simple? Really?

How could I know that the simple method chaining wasn’t a core feature of PHP4? And I developed on PHP5 version. So, thank you, try better next time.

Luckily, the latest version was also installed on the server, so it was only a matter to switch.
But it could not be so. And I would have had to split all the lines like:

$result = $DB->Execute($sqlQuery);
$var = $result->FetchRow();

The moral of the story is: try to work as closely as possible to the production state. The results could be unpredictable.
And now, if you ask me, open your window and let the fresh air come in.

Sapere prima di fare (sulla coincidenza)

Ecco un altro episodio che mi ha insegnato come sia necessario sapere prima di fare.

Il compito che mi era stato assegnato era semplicissimo: mostrare una data formattata in JavaScript, tipo 7 Ottobre 2012. Che difficoltà poteva esserci?

Continue reading “Sapere prima di fare (sulla coincidenza)”