Mon: Chasing the BUG: Andela Labs
Max is a smart guy, as much as he doesn’t like to be referred to as one. He always stressed the importance of maintaining proper syntax when writing code,“Mind your semi-colons”, he said. This advice comes more than 1 years ago as I started to dabble in JAVA programming. Maybe you are wondering why I am rambling about a humble semi-colon? Well, today I met its cousin; the colon. I shall refer to this situation as the Ghost of the Missing Colon.
Lets me take you to the beginning of the Ghost of the Missing Colon, to the start of one of the most stressful days of this week. It all started with the writing solution to the car lab in the Andela Labs platform. The code executed well perfectly on my laptop, all the test passed. I couldn’t wait to check the box on the Trello board, signifying another step made toward the dreaded Friday purge.
all smiles and full of expectation, I copied the code and swiftly placed it to the Andela labs. Pressing the test button, I felt the rush of adrenaline iIwaited for the progress bar to stop and indicate it had passed all the test.
An Error Occurred Running Your Script
“It can’t be right, am I wrong? Did I make a mistake?”, I asked myself. “Maybe I should try running the code locally again. I must have a logical error”, I thought. As suspected, I had three red lines of code on my terminal, signifying the failed tests. I quickly scanned the entire file for simple syntax errors: misaligned indents, missing underscore on the function and variable names, and missing quotation marks on the string declaration.
Then I saw it, a missing colon on the first if statement. What a relieve it was to find the source of the bug. a simple missing colon at the end of this conditional statement was the cause of my failed tests and utter frustration. with one keystroke, the bug was fixed. I hurriedly copied the code to the Andela labs and pressed the yellow test button. it passed all the test, ending my little panic. Now relaxed, I tried to submit the solution. It failed again, the Ghost of the Hidden test had struck again.That is , however, a story for another day