Today I read two articles, one about how to write clean code, and one about common code smells. A lot of it was pretty familiar, but there were some things pointed out in the articles that I wasn’t fully aware of and will definitely be keeping in mind the next time I am coding.
One thing I want to start doing more often is really focusing on keeping my code modular and reusable whenever possible. I should always avoid repeating the same logic multiple times. I should break down big chunks of code into smaller individual functions. And I should make sure to maintain a clear flow of execution in the code where a logical structure is followed from beginning to end. The clean code article provided the following example:

This example shows how even a small and simple function for calculating a price total, can be improved through modularization, making the code more readable and reusable. I have found many times while coding that modularization has been obvious for certain chunks of code, but other times its not so obvious how to effectively break up an oversized function, even though it would be very beneficial. I want to be more thoughtful and aware of this in the future.
On the other hand, one thing I want to avoid doing is creating “data clumps”. The article about code smells gave the following example:
This example shows how it can be very useful for readability and to improve organization, if a group of relevant parameters are kept together in a class. I have on multiple occasions used a similar connect() call as in the first part of the example and I now realize how ugly it looks. I will be avoiding this code smell as much as possible and instead implement database credential classes when they are applicable.
Clean Code Article: https://www.freecodecamp.org/news/how-to-write-clean-code/
Code Smells Article: https://8thlight.com/insights/common-code-smells