Punctuation is Key

Every developer wishes for bug free code, but the reality is bugs happen. Early on, a super simple bug nearly crashed my prototype into the ground before it could take off. Or should I say, skyrocketed my prototype into the vast unknown with no way of knowing how to stop it? Either way, I learned the true importance of punctuation.

There I was, a young (it was three months ago) bright eyed developer with the world at my fingertips, having just figured out how to program player controls and working on my prototype while simultaneously working on the exercises for my virtual class basking in the ego boost of applying what I was learning to real world software. Everything was working like a dream, aside from my graphics being so primitive that my player was a single blue sphere on a simple plane.

I stared at my player controls, proud that I had done it all by myself and did a test run rolling that little sphere all over the plane. I created blocks for it to jump on to to make sure my game mechanics were going to work the way I envisioned. I was on cloud 9. I did a thing, and it was working! I really could be a game developer!

In an effort to clean up my code, I tried out a suggestion from a developer with decades of experience on me. I went to run my code in the compiler and immediately, that single sphere took off into the sky.

It. Kept. Going.

Up up and away it went, I watched the coordinates increase until they couldn’t be calculated by the platform. My sphere not only went to cloud 9, but waived goodbye to clouds 10, 11, and 12 as it soared into oblivion. What had I done?! Panicked, I re-read my code looking for the bug. I deleted and retyped the contents of the parentheses. My little spherical friend still journeyed to the outer layers of the atmosphere.

I tried adjusting the physics equation for the gravity. No difference. In my panic, I imagined this little dude yelling “WHEEEEEEEEEE” as it went. Nothing was working. My prototype was ruined. All I could do was laugh manically as my dreams went up in flames before my once bright eyes.

I called my husband to have him look over the code. He wasn’t familiar with the language, but maybe he could see something I couldn’t. It was no use. My little blue blob was shooting into the sky as if it had been launched from an invisible cannon.

Finally, I went back through my code character by character for the umpteenth time and found an extra semicolon in the middle of my if statement.

Rather than waiting for space to be pressed, my beloved player prototype was just jumping straight out of orbit. As soon as I removed the erroneous semicolon and reset the physics back to where they had been before this mess, it was working properly. I finally had my bug free code!

My middle school English teacher was right. Punctuation saves lives.

Read more about my coding adventure!

Leave a Reply