Cleaner Code

Winter break has ended, and now the term has started up once more. The first post I’ll be making for the term is about writing clean code, which boils down to code that’s easy to read and understand. However, there’s more to it than just making sure your code is commented. A lot of times when I implement a function or other part of the program, I end up just moving on to the next part because it works. I don’t actually think about whether or not it’s as efficient as I can make it, which often means more for loops and if statements than there needs to be. An example in an article I saw included the following:

These two functions both do the same thing, yet one is cleaner than the other. This is the kind of code you should strive for, and its what I plan on trying to integrate in my coding practices.

References:
https://www.freecodecamp.org/news/how-to-write-clean-code/
https://www.sciencedirect.com/science/article/abs/pii/S0164121220300881

Print Friendly, PDF & Email

Posted

in

by

Tags:

Comments

Leave a Reply

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