That’s it, you’ve done it. Spent countless hours programming this feature, the design was excellent, the coding grueling but finally: It is ALIIIVVVEEE…Wait! What was that? No…No, that’s not how it’s supposed to go, WTF (What The Fortran)!?. And so it begins, you now need to DEBUG! Personally, I do enjoy it and i recognize that due to its nature, it is understandably not a cause of enjoyment for all. First of all, there has to be a distinction made between debugging your own code, and debugging code written by somebody else. I do not enjoy the later as much as the first.
Debugging someone else’s code
Debugging somebody else’s code is obviously a longer process, where you have to get into their thinking mode, and reverse engineer their code. If the code lacks comments or proper documentation and is not particularly clearly written, then to me, debugging becomes a necessary, soul sucking, sarcastic evil. It can provide for some entertainment though, and is nonetheless a good learning tool whether the code is great, in which case you learn new techniques or patterns and improve yourself, or find the most horrifying pieces of code that even as an inexperienced but sharp programmer you can detect all that is wrong with. In both cases you are able to grow by learning from someone else’s coding abilities (or not).
Debugging your own code
To me this is where most of the fun is, as I think of it as me against myself type of fuel. It offers incredible insight into the way your mind works and increases your self awareness. It’s a game of highs and lows where at times I’ve felt like the smartest person on earth for coming up with a clever solution for a particular bug, or the dumbest for making such a dumb, obvious, noob programming mistake. And sometimes a mix of the two but nonetheless a rewarding experience.
The debugging mind
I’ve realized now through my career that the same set of problems usually have the same set of solutions. That is the crux of experience. My greatest gains as far as knowledge and experience have come not from designing a new solution to a problem, but rather from coming up with alternative for an existing one. The number one skill required in debugging is, and let me put it in bold: patience; this is where most realized that they were not built for computer science in college. Through the first programming assignments and the obligatory long debugging sessions that followed to ensure that the code turned in did what it was supposed to, those that were not cut out for computer science were initially weeded out, including friends of mine. It takes patience to sit in front of a computer screen staring at lines of text that are not part of Facebook or Twitter, re-running the same piece of codes, hundreds if not thousands of time and still not getting them (lines of text) to do what you want.And still go back to it. And again. And again…Until you get it. And this is where the second crucial component comes in, and not just in debugging but in programming in general: passion.It does not take only patience to sit in front of a computer for hours when you could be doing ten thousand other (better?) things. It takes passion, and most of us in the field are in it because we love it and love takes sacrifice sometimes.
The Bug, in programming, is usually of our own making. Like a rebellious child bent on destroying its genitor (at least that’s how i see it). It can be subtle, smart and refined, or on the opposite freakish, flamboyant and agressive. The latter is usually picked up at the compiler level, and can be promptly subdued and compiled merciless into submission but the former…Ahh the former, The Bug….it is the silent ninja assassin created and trained in the depth of our mind who comes out attacking in full force once the program is running. In debugging I have learned that indeed as The Ghetto Brothers have rapped about, “my mind is playing tricks on me”. Sometimes The Bug is sitting in plain sight in my code, and after pulling countless hours trying to find a solution i realize that it had just pulled an “Wandering Eyes” ninjutsu that had me looking everywhere else in the code but the most obvious part for it. I do feel dumb and taken advantage of when that happens. But it is all part of the game because as I also learned, The Machine Only Does What You Tell It To. I’ve spent countless hours screaming at the code for not getting the logic right only to find out that mine indeed was the logic that was flawed and that The Machine Only Does What You Tell It To. Enough said.
To those programmers that enjoy debugging, I think the enjoyment comes from The Challenge. The Bug is indeed an enemy, standing in the way of your own self assessment as a (very) good (even excellent) programmer. The Bug and The Machine are plotting against your intellect and have officially thrown “The Challenge” to your face. How disrespectful! It is as if they were 18th century Frenchmen who just pimp-slapped you (reverse of the hand) and said: ‘I challenge you Monsieur, to a coding duel!’. Are you going to take it like a Frenchman(*See legal disclaimer)? Are you? Non Monsieur! They shall soon regret rising against your algorithm magnificence!
Once down from your ego high, you realize that although it strongly feels like a duel between Man and Machine, where most of the time, you are really fighting yourself.*Legal Disclaimer: I by no mean imply that a Frenchman taking it is nothing more than a Frenchman taking it in the context of an 18th century duel. I have nothing against the French, in fact my best friend is French (and his name is Fry’s like in Futuruma).
Debugging would not be the same without search engines. Debugging would not be the same without Google. As a matter of fact, I’ve gained respect for the old school programmers that used to fight it out by themselves. Today, your Google-Fu mastery may be as effective as actual coding/debugging skills to resolve problems. I would like to think that I am at least a Google-Fu black belt (I will tell you for sure next month, I am taking the certification exam). The trick in using Google, and where most brown-belt-and-under Goog-Fu practicioners fail, is learning to properly formulate your search terms. I know the secret, polished and sharperned by years of practice, and I can teach you, for a nominal fee of $7.99, but WAIT! If you tweet this now, not only will i teach you the secret once, but i will teach it to you TWICE and if you still don’t get it I will slap you in the back of the head until you get it! But seriously, for most bugs, the developers community have been good through various sites in documenting most bugs and even in the case of new or specific-to-your-own-case ones, by being a little analytical, you are given enough of a clue to know what direction to look into. More than often this is enough to reach a “RESOLVED” status on The Bug. By the way, when you ask a question to the community on a forum, get help, or figure it out on your own, come back and post it for future generations. If you don’t fine but don’t come back and post “I’ve figured out how to do it! “, not post your solution and disappear for good in the depth of the Internet. That gets you bad karma. I know, I’ve sent it your way. Debugging can sometimes be a detective game and understanding it from that angle will sometimes help relieve the tediousness of it. It sometimes take painstaking, slow, detail oriented work to solve the crime but when that happens The Yeah! Moment is a reward in itself.
The Yeah! Moment
This is the moment we do it for, whether it’s debugging or programming, the moment where IT WORKS! The gratification, the adrenaline, the rush, the congratulations, the hugs, the smiles all in sloooooow motion. The Hollywood moment. The Kick. More than the paycheck, that’s the feeling we are craving and working for. It’s the sense of accomplishment as I was explaining to my wife that keeps you coming back. I think one of the greatest things about programming is that you can go home everyday and feel like a million bucks because you feel like you saved the world (as defined in your business requirements). The Bug has been conquered, The Machine subdued and Man reigns supreme.
The Council Of The Sages
So The Bug died a horrible death and the sun started setting and you and your laptop turned to the camera and shared a passionate kiss when all of a sudden…
In conclusion I hope I did not turn my one paragraph blog thought into a full fledged i-don’t-know-how-many paragraphs ramble but since it seems like i did and that I rambled more than I thought about debugging I will just accept the facts as they were and strongly encourage you to do so if you are still reading. Debugging does not have to be a drain on your morale. If it still is, just imagine The Bug and its eville associate, The Machine having a drink on you, giggling, pointing fingers at you, laughing hard hahas of the Simpson’s Nelson haha! Are you gonna take it? Are you?
Note: Be sure to come back next week for my next post: “Testers: The Enemy Within”. Yes I said it!
Leave a Reply