Clean Code: Planning for the Future

An important part of being a software developer is writing clean code, especially when being part of a team. An article that I read described some tips on how you can write clean code. These tips included readability, consistency, simplicity, selecting meaningful names, and a few others.

Something I would like to do more often to create cleaner code is related to simplicity. I would like to do better at separating related parts of code into different functions and reusing functions for similar purposes within the code I write.

I think this has partly been difficult for me because of deadlines and due dates for assignments. If I write a lot of code within one function and it ends up working, even if it is somewhat unrelated, it is hard to want to refactor. If I have the necessary parts working for an assignment then I know I can move on to other things instead of spending more time on it. There is also the worry that something will get messed up in the process of refactoring.

Although this is something that feels difficult for me to do, I would like to improve because I know it will be helpful in the long run, especially in team settings.

There are a lot of bad coding practices that would be good to avoid, but a specific one I want to avoid is adding too many comments. The article I read had a section titled “Apply Comments Strategically.” This can also be related to choosing meaningful names for functions and variables because that will decrease the need for comments. Avoiding unnecessary comments will help code be less cluttered and will “force” you to let the code describe what it is doing itself.

This is a good refresher of things to keep in mind as we get into this next term!

Sources:

Espinosa, G. (2023, July 2). The Art of Writing Clean Code: A Key to Maintainable Software. Reflectoring. https://reflectoring.io/clean-code/

Devopedia Foundation. (2022, February 15). Code Comments. Devopedia. https://devopedia.org/code-comments

Print Friendly, PDF & Email

Leave a Reply

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