Code, Pizza and my Stupidity

Morning 09:00

Saturday morning. Quite a peaceful day. I am so excited to write the code for a web application that I have been working on. Little did I know that I am going to spend the entire day debugging an error that is hiding in my code.

I had a strong espresso before sitting in front of my laptop and divided the task into three components.

  • Take input data files from user
  • Perform calculations on received data
  • Show the results to user

I started writing code for the first part. At each stage I was testing how the application is going to look in the browser. I was careful enough not to miss any semicolons (;). Because, I remember

semi

Afternoon 13:00

By this time I successfully wrote the code to take-in the user provided data into server to perform some calculations.

Me: I feel Good. Brain: Enough, Go grab a coffee.

I had one more espresso, this time Indian Sundara (Highly recommended). While having coffee, I mentally drew a framework how I am going to write the code to perform calculations. Task started again. Sublime page is being filled with the code to perform calculations. This time it took three hours to complete the code including the code for final task, “showing results to user”. It’s time for testing.

  • Input some test data
  • Start calculations

          PROGRAM RUNNING . . .
    

It showed something. It was not the results but an error.

Nooo. I don’t want this to be happening. I closed the application and tested it again. Of course the error didn't correct by itself.

I carefully gone through the entire code scanning for any obvious bugs. I didn’t find any. I tried to print exactly the input data as result on the screen without performing any calculations. It showed perfectly. I concluded that the error is in the code to perform calculations. I started probing the internet for this kind of error. I found some similar ones but not the exact one. I tried different debugging methods, some of which I already knew and some are completely new. I got to know different debugging methods which I didn't know before. Different methods work for different bugs. But none worked for mine. It seems the error is not the usual one, if it is, it should've been caught by one of these debugging methods.

Evening, 18:00

Me: Heck, this err.. Brain: Stop complaining, go get a coffee and write the entire code again. Me: Okay, as you say!

I started writing entire code again. This time with utmost care, hoping to avoid the error. After 90-100 minutes of coding, I tested the application again.

Error

Oh God! Do you even know that I exist in this world. I know you are busy but at least help me once in a decade

What is wrong with this code, I yelled. Again, I started probing the internet. Every time, I found the same solutions which didn’t work. I checked the code again. Tested the application with different test data. Printed again the input without calculations. Came to the same conclusion that the error is in code to do calculations.

Brain: I don’t think you are a good fit for this job. Quit and look for a simple and easy job. Me: 😏

Night: 23:00

Aargh! I am feeling hungry. Let’s work on this tomorrow, I thought. I went to buy pizza, yes I love pizza at midnight, at a shop across the street. I was walking down the empty streets filled with darkness and dim lights, with my pizza.

All of a sudden something striked in my mind. In simplest explanation, what I was writing in the code is the following

"II x 2" and expecting it to give 4

Obviously, program is unable to understand two different formats (roman number and numeric), that was what causing the error. I have to convert one format type to the other in order to get the results. That is

"2 x 2" which should give 4

Yes, that was the error. I rushed back home, modified the code and tested the application.

Guess what ?

Yes, my code is working perfect.

Aww! I am such a stupid. This is a simple bug. I spent almost 6-7 hours to find this.

Did I simply waste 6-7 hours ?

No, all those hours were not waste. In the process

  • I got more command on the programming language
  • I learnt more debugging methods which are definitely useful in the long run

and most importantly,

  • I learnt patience being a millennial
  • I learnt to overcome self-doubt inner voice
  • I learnt that when things don't work, I should leave everything and go out for a walk (and buy pizza)
  • I learnt that I'm a STUPID
Avatar
Venu Thatikonda
PhD student

Interested in Data science, Machine learning, Cancer (epi)genomics.

Related