I have always had problems writing a well-documented code, this is pretty common for individuals who like me, work on many projects as a one-man show.
The one-man show
I was able to juggle multiple tasks from different repositories, and what I thought was a quick fix and an easier way to finish tasks fast turned out to be hell for me in the long run. Code maintenance became a difficult and simple changes took a while before being implemented.
How will writing clean code help
- To have better code documentation and understanding
- If you have a team or want public contributions
- To better maintain and build upon your repository
After realizing
After endless research on proper code ethics that can cut across different languages and frameworks, I was able to compile a list of four key practices that helped writing better and easy to maintain code styles.
README File — This file should be placed at the root of the project. a good README file should contain (Project description, Who maintains the project, Installation instructions, and how to contribute to the project)
Write documentation on complicated functions — A good function documentation contains the following comments ( What a function does, what the function parameters are expected, and finally what the return response and data type will be)
Right Coding conventions — proper file organization will help contributors to find files and classes easier, applying the right naming conventions might save a lot of dev time spent looking and understanding what the code means.
Make Linters Your Friend — Not everyone is comfortable with this, but having a clean code you must love linters. Linter help to identify programming errors, bugs, stylistic and formatting errors, or even unused code.
Want to keep in touch online? Medium | Twitter | Instagram | Behance
Top comments (0)