I’m sort of a naive programmer; even though I have a couple of years under my belt coding in C and C++, at the end of the day I still kind of suck. Am I getting better? I’d like to think that I am, otherwise I really should have jumped this “Computer Engineering” ship two years ago or so.
But in the process of learning how to code, I think one of the most important lessons that I’ve come across is the idea of readability. It’s a simple one, and one that I think that most people think about when they code, but still an idea that warrants talking about. Readability and the coding standards that make readability possible are, in my opinion, one of the most important concepts when encouraging young programmers to learn how to code.
Here’s a little story about my journey through the Computer Engineering program: Before I started college, I had absolutely no programming experience. Like, none at all. I had no idea about counters, loops, if statements, and anything else.
Then I took my first programming class, which was in C, and let me tell you, I had absolutely no idea what was going on at all. The first couple of weeks were so awful; I felt stupid, incompetent, slow, and so very clueless. Just imagine being shoved into a world that you don’t know and understand, and trying to make your way around. It wasn’t pleasant for me.
But after the initial culture shock of the programming world, I started to see patterns. My professor would spend entire lectures on how to look at things, how to read things, where things are, and all that good stuff. At some point, I remember going on Github and looking at some code that people put up, reading it, and trying to do a manual trace of the code. In the beginning, everything looked like a great wall of text, but over time I began to understand it, and understand what people were doing in their code.
I couldn’t understand everything, but I started to understand more than what I did before.
And the ones that I could understand the best were the ones that followed the same format that my teacher laid out; the coding standards that he said everyone used. The thing about coding standards is that for someone who was in my position, that didn’t understand a lick of C at first, having people write in the same format makes all the difference in the world. Being able to correctly space things to make it clear, add comments for someone to follow your thought process, and separate items makes it easier for novices to understand and read your code.
Even if the person reading the code is more experience, formatting correctly will make it easier for them to read through unfamiliar code and do whatever it is that they need to do.
Again, I don’t think I can stress enough how helpful it was for me as a novice programmer to begin to understand C if it were not for coding standards. And now that I’m more experienced I try to follow these standards in order to make it easier for people who want to read my code.
I think it is our responsibility as people who understand programming to try and uphold coding standards. Without standards like these, I don’t think I would have picked up C as fast as I did. It encourages us to make our code easier to read, encourages others to read our code, and encourages novices to try and understand our code so that they can start learning themselves.