29 / 06 / 2022

36. why we need and how to start writing clean code 1

Since I started learning and working on coding, the first thing I know is that we should write clean code. Clean code is understandable not only by computers but also humans as well. For individual projects, the codebase is not that large but even sometimes it may be difficult to fix stuff if clean code approach doesn't apply. Maintainable code is extremely important within a large important.


First, we have to know how to name variables that is unique and could provide enough information for people to understand. This is important for other colleagues to maintain but also for ourselves for visiting the code later. Also, we should avoid using names that is misleading, for example, data types that is not matching with variables. As well as some other words that provide unnecessory information, for example, names rather than namesData. The variable have to be meaningful wordings and no magic numbers are added randomly. Moreover, the action words should be consistent within the codebase, for example, don't use fetch and get together.