Musée des horreurs – Témoignages

Quelques raccourcis :

Quelques récits et témoignages dignes de mention...

Entrée 00 – L'offre d'emploi dans un milieu où règnent les variables globales

Le témoignage : j'ai reçu un courriel (d'un ami d'un ami d'un...) en 1999 qui contenait le message suivant :

« I was asked about taking on a contract to maintain a piece of software.

Something about the way it was presented made me wary. I asked to look over it first. What a sight! I use it as an example of why not to use global variables.

Among other things, there were files with suites of functions on the following order:

void adjust_alpha()
   alpha = gamma + offset * 3;
void adjust_beta()
   beta = gamma + offset * 3;

Dozens of functions that differed only by the global variable they modified.

Just picture it: a multi-thousand line program with a graphical interface and a database that never used function parameters. The original programmer painted himself into a corner with his variable names.

Clearly if you need variables "up", "down", "left", and "right", you name them as such. When he found himself needing those direction names in different parts of his program but was stuck because global variable names had to be unique, his solution was to use names like: up, _up, up_, Up, uP, UP, _Up, _UP, down, _down, down_, Down, dOWN, DOWN, _Down, _DOWN... and so on. Even the densest of my students comprehended immediately why that was bad.

Needless to say, I turned down the job. »

Je vous laisse constater (et digérer) l'horreur...

Entrée 01 – Régler un bogue

Je vous invite à lire ce chic témoignage décrivant une technique pour « régler » un bogue, sans vraiment régler quoi que ce soit...

Valid XHTML 1.0 Transitional

CSS Valide !