DEV Community

Jose Tomas Gonzalez
Jose Tomas Gonzalez

Posted on

Stop killing kittens

First of all, this is the second time that i wrote this article. Lost the first one because didn't hit "save post" shame on me.


At college we had a course called "Code quality and software verification" that teaches you how to avoid (as the teacher said) killing kittens. Every code atrocity kills a poor innocent kitten, and it gets buried in your personal kitten graveyard.

My first kill (not proud) was

var asdf = 12

So time flies and you start working as a developer for a business company, they have a web app that shows it clients their accounts and how their money was being invested by your company.

Your boss assigns you the task of developing a new module "The Hyper Calculator of Something 4000". You know how it should work but that's all, you have no idea for what it will be used for. Coding happens and since time is money, you give the luxury of killing some kittens. One here, some over there.

After delivery you have about 5000 lines of questionable quality code but the important part is that works and made your boss happy. All good for me!

Then caos happens, your mystery module starts crashing and giving unexpected values, the company clients think that their money is gone. Your boss is exasperated that you are taking so long to fix the bug because, you wrote the module, it's your code!!

You have your hand on the mouse, ready to click over a file but.. "it was the asdf.py or the finalVersion003.py" you start opening files, looking inside your spaghetti code, digging between kitten bones, using the debugger until you manage to raise an exception VOILÁ!!! wait no.. the console says "Exception occurred" that is some very useful piece of information (not).

Your dead kittens are coming for you and you have nothing to do to fight them. Clients start to leave the company and your boss trying to help you looks your code and finds your graveyard, a cleaner code would have enabled you to solve the problem faster and lost less clients. So he gets so mad because that you get fired.

The problem with coding is that it's almost impossible to code without creating bugs, it's something that you will have to live with.

Bugs live in your code and feed on your dead kittens, the more kittens, the stronger will be your bugs. Well not the bug itself but you get the idea.

Code quality is used not because it's bad killing kittens, but because your dead kittens will rise against you and the ones close.

Protect yourself of those zombie kittens.

Top comments (1)

Collapse
 
raibtoffoletto profile image
Raí B. Toffoletto

This is so true!
I'll start using this analogy, nothing like the image of an army of zombie kittens chasing you to make people write clean code.