A Story to Make You Appreciate Coding Standards

10 Feb 2022

It Begins…

I won’t lie, when I started programming, I hate(d) coding standards. It annoyed me that I had to learn a bunch of extra stuff just so my code would look the same as the next guy’s. However, having been programming for a couple years now, I find that I really appreciate those same coding standards I once hated.

I started my journey into the wild world of programming with Java, and if you’ve ever coded in Java, you know how important coding standards are. With how specific Java is about declaration of variables, functions, classes, and more, coding standards are not only essential here for base readability, but also for functionality of your program. Whether it be in file management of in the running of the program itself.

A little story about why I, at least, value coding standards:

Story Time

While I did start with Java, I didn’t remain with it for long; I moved on to C++ and then to C# shortly thereafter within a couple months after the end of that first programming class (Information and Computer Science 111, if you’re curious). I had begun the ICS pathway at Windward Community College in order to pursue a life as a game designer, and towards that goal I did research on the best programming langauges for game design and found that most people reccommended C++. So there I was learning C++ and downloading Unity only to find out that Unity used C#, after a quick shift of programming languages I was on my way to my first prototype.

My first game

At first I only followed tutorials in order to get a feel for Unity, Brackeys was great for that, the code was clean and easy to understand; he explained it all in great detail and was very clear in said explanations. After successfully following along a couple different mini-game tutorials, I tried my hand at it. It took me about three months but I got something working and was very happy at it. I got busy with sports around that time and put it away with the intent to return when I was ready… until last year I never did.

Coming back to it

Errors Last year I took a higher level game design course, and as a final project I decided to revamp and recreate my first prototype. I redownloaded it from an old hard drive and opened it up in Unity. What I saw shocked me. Errors. Errors galore (this is not an actual shot of my game just something off of Google, but it’s not that far off!). What, at the time, I thought was a spectacular achievement in programming, turned out to be a jumbled mess of barely working nonsense. Lines weren’t evenly spaced, there were too many random variables to count, not a single comment as far as the eye could see, and more. Honestly, I’m amazed Unity could interpret what was written, because I sure couldn’t… and I wrote it! After reworking what must have been 15 different files worth of C#, many of which were simply redundant but somehow after removing the entire thing stopped functioning, I realized just how important readability and clean, standard, code is. Spending a couple months looking through some of the worst code I’ve ever seen will do that to you. I could have saved myself hours, and hours, and hours by simply commenting what some code did. But of course not. I could have saved my eyes physical pain had I simply gone back and indented a couple lines, but no, I had to scrape through hundreds of lines to find a single missing bracket. It wasn’t fun. But it did give me a new apprecition for coding standards that carries over to this day into every line of code I write. So if you’re like me and hate coding standards, try fixing really bad code, you won’t hate them so much after that.