Vous aimez ce que vous lisez sur ce blog ?
Envie d'aller plus loin avec véritable formation d'expertise en Java ?
Venez suivre ma formation Masterclasse Expertise Java !

"Même un développeur experimenté a besoin de continuer à apprendre. Et dans cette formation... j'ai appris beaucoup !" - A.G., Java Champion

Sessions intra-entreprises sur demande : contact[at]mokatech.net.
Inscrivez-vous vite !

Categorizing software bugs as Minecraft mobs

minecraft.jpg

I don't know if you play Minecraft - but if you don't, you should.

It is basically a sandbox construction game, where you can do whatever you like : crafting tools and materials, explore caves or dig mines to find ore and diamonds, create whole cities with your friends or wander around til the sun sets.

Then at night, things are different - this is when monsters appear. Minecraft mobs come in a variety of shapes and degree of pain-in-the-ass-ness. Some are quite inoffensive, others can ruin a whole day's effort in a second.

It struck me recently that those mobs were indeed quite representative of the varieties of software bugs. Let's see how.

Zombies

zombies_minecraft-france.fr.png

Zombies are the most basic Minecraft mob. They are everywhere, and you can often hear them groan and moan quite loudly over the hills or through the mine walls.
When they see you, they run right at you and punch you in the face til you get rid of them with whatever you have at hand - sword, shovel, or a tree log. They are an immediate, visible danger that cannot be ignored, but they are not very strong and quite easy to eliminate.

Zombies represent the standard software bugs, the common coding mistake that everyone makes several times a day. Quickly spotted when testing the application, easy to correct, they are not a real danger.
Experienced developers learn to pay attention to code noises, and are able to avoid most common bugs.

Skeletons

skeleton.png Skeletons are more dangerous and vicious than Zombies. They usually hide in dark places where you cannot reach them, and shoot arrows at you when you happen to come within reach. The first notice of a nearby skeleton is often an arrow striking the wall where your head was just a second ago.

While wandering around at the surface, you can often choose to ignore Skeletons, as it is not very convenient for them to leave their hiding place and chase after you. But if they really piss you off, they are not hard to beat either - providing you can reach them before looking like a porcupine !

Sometimes, developers intentionally ignore potential bugs and code smells. "This should work for now anyway, I'll correct it later" they say, or "This looks really bad, but this not my code", and they quickly walk out of the danger zone while arrows fly in the air.

Ignored bugs tend to get their revenge one day or another. They wait patiently until they reach a critical mass, then one of them hits the right spot - the one that brings the whole production down. And when it happens, the team doesn't have any choice but face its responsibilities and correct the problem now. But it is too late ; the bugs have become so deeply embedded in the code that any attempt to correct them is at best highly risky.
Conclusion : Don't. Ignore. Bugs.

Spiders

spider.png Contrary to Zombies and Skeletons, Spiders do not fear daylight and do not burn when the sun rises, so it is not uncommon to bump into them while exploring the surface. Fortunately for the adventurer, they are only dangerous at night, hissing in the dark and looking at you with their many glowing red eyes.

When enraged, Spiders are really dangerous. They can climb walls to reach you where you thought you'd be safe, and jump great distances to attack. Plus, everybody hates spiders, for, well, being spiders.

The most deceiving bugs are those which happen only in certain circumstances or environments. They are really hard to detect and explain, and even harder to reproduce on the developer's machine. Multi-threaded and distributed programs are particularly prone to this kind of bugs.

In an ideal world, the development, testing, pre-production and production environments should be identical, and the pre-production tests should be run with real production data and load. Unfortunately, this is not always possible, and Spider bugs are always lying in wait for striking.

Slimes

slime-big.png

Slimes are somewhat rare in Minecraft. They are only found deep in caves, hopping around like green jelly blocks. They come in a variety of sizes, from the small cube-sized ones to the giant Slime Boss. The problem with Slimes is that they split into many smaller ones when you hit them. You can easily be overwhelmed by an army of small cute Slimes after hitting a single big one if you are not cautious !

many-slimes.jpg You know you face a big Slime bug when working on a seemingly simple glitch in the program turns out to be much more complicated than expected. The bug may have many ramifications throughout the entire codebase, and touching it may have unforeseeable consequences.

Slime bugs often stem from simple Skeleton bugs that have been ignored for too long. "There is a bug here, we must correct it" says the developer ; "We don't have budget for it now" says the manager. And day after day, month after month, the Slime bug grows and gets buried even deeper in the application.

When it happens, you know you're doomed. Never let technical debt accumulate !

Creepers

creepers.jpg

Ah, Creepers. The biggest fear of all Minecraft players. For you see, Creepers are the most vicious of them all. They sneak up on you silently, and then explode like hell, destroying blocks in a large radius and sending you flying in the air. Many players smashed their keyboards out of rage or stared unbelievingly at their screens after losing their home or cubic works of art !

creeper-wall.png Creepers bugs are the worse.
They come in two forms : on one hand, the horrible production bug that causes havoc, for example by deleting half the database because of a missing "where" clause (but you do have backups, don't you ?) ; on the other hand, the seemingly inoffensive bug that suddenly makes you realize that the whole architecture is flawed, or the code itself is so bad that the bug cannot be corrected without a massive refactoring or rewriting.

Creeper bugs can cause serious delays in projects, or bring them to a full stop. They can also cause teams to be torn apart, millions to be lost, and people to be fired.
You don't want Creeper bugs.

Conclusion

sheep.png Minecraft is a fun and creative game, all about making new things, on your own or with friends. Many thanks to Notch !

In my opinion, developing applications should be the same - a cooperative and creative activity. In both cases, though, Sheep happen, and mobs or bugs can ruin your best efforts. But with some discipline and precautions, everything will be alright. Play safe !


Commentaires

1. Le dimanche 11 septembre 2011, 23:44 par Dave

Love the article :-) Looking forward to the 1.8 update, time for a new server from minecraftclan.com I think!

2. Le lundi 28 novembre 2011, 14:03 par Kyoku57

J'adore le parallèle fait dans ta conclusion. Dommage que ce jeu soit aussi chronovore .. j'ai vite abandonné quand j'ai vu le temps que je passais à miner (et le pire c'est que j'aimais ça)
Je m'y remettrai quand Notch aura libéré le code source (il me semble qu'il a envisagé ce cas de figure). Je pourrais jouer à un autre type de jeu avec lui.

Ajouter un commentaire

Le code HTML est affiché comme du texte et les adresses web sont automatiquement transformées.