Blog Post #1


Writing clean code is one of the most important things to strive for when programming so that others are able to understand your work more easily and future changes can be made without having to relearn what code is doing. I found this graph here taken from GeeksForGeeks to be especially helpful for illustrating the importance of clean code.

I have always tried to keep my code “clean” but that definition has changed over my learning as a programmer. When I first began learning to program,  I learned that writing comments was one of the best ways to keep code readable, so I struggled with the problem of over-commenting on my code. This leads to issues where the important and actually confusing parts of my code were more difficult to find since there were comments everywhere. After taking one of my classes at OSU I learned that clean code should not actually require many comments. Through the use of descriptive variables and thoughtful functions, code can mostly be read and understood without the use of extensive commenting.

One technique that I want to add to my skills in writing clean code is writing short functions that only do one thing. As mentioned in the article 7 Practical Tips for Writing Clean Code on the website Hatchpad, it is easy to just write programs in one main function, but compartmentalizing it helps drastically with readability. It also helps with debugging issues, as it can then be traced back to a single function rather than looking over the entire program.

Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *