Revisiting code is never like meeting a old friend, that no matter how long it passed you always seem to know it.
After a week it becomes a Pandora box (even though you left so many comments for yourself).
I will depict a typical case scenario of the world I live in, my head.
The beauty of the dissociative identity disorder is that it allows me to expose my thoughts in an interesting way. So let’s assume 4 characters : the oracle, the master, the slave and the unknown voice (yes, it is clearly under determined).
- The oracle is the mastermind, it designs mental conceptions and solves puzzles.
- The master perceives a problem and recurs to the oracle for a solution. It then orders the slave to do the tasks.
- The slave most of the time performs mindless work unless there are contradictions for which he contacts the master.
- The unknown voice has always a word of advice.
It often works in harmony, except for apocalyptic reasons such as … hum… spring coming. The beautiful season of love, flowers and pollen, lots of pollen (Still wondering who I should blame, bees and wind for not transporting it elsewhere or just the lame urban architects). Happens that I have to take some pills to prevent lovely rivers coming out of my nose and my eyes exploding with joy. And these pills are just like a bailout of jail to the oracle, i’m still not sure if he sleeps or goes somewhere else but he sure comes back after a while. And during this time, the master reverts to random guess or even brute force, you name it. So this is how it goes:
-The Master- So we have to fix this old code! It fails when transiting from one state to the other. For sure the oracle didn’t predict this transition! Slave, implement this transition!
-The Slave- Hum, the transition actually works now and then, the code seems to work in unpredictable ways!
-The Unknown Voice – This is not real, kill them all!
-The Master – I have no idea how it worked, put printfs all over it! (debugging in Android is never a trivial task)
-The Slave – fills everything with useless printfs
-The Unknown Voice – This is the Oracle, all this your doing will never benefit you! Embrace the darkness, kill…kill!!
-The Slave – OMG… Now it prints so much sh*t that I can’t debug it!
(After a few lost hours of mindless printf debuging…)
-The Slave – This is too complex for me… for sure the Oracle should have done it correctly!
-The Master – Maybe I can read the Oracle diary. Goes to bitbucket . Reads issues: badum ba badum… turn on reliable communication for 3G…… DOH!
(Typically the Oracle does work right, and when he doesn’t, he actually leaves a comment on code and an issue on the abandoned bitbucket issue warehouse)
So the conclusion is :
Always listen to your inner voice for at least it might be correct in an alternative dimension.
Oh, my other voice is telling me this might ruin my future job alternatives, let me paraphrase it :
First of all, once again commenting and filing issues proved to be great in case you have to revisit your code (doesn’t matter how readable you made it). Secondly, remember to read this comments and issues before trying to fix it!
Hope you enjoyed and sorry for not posting lately! 😉 Once I finish the thesis I shall post a few nice algorithms!