DEV Community

Cover image for The perfect way to Writing Code Documentation
Kenzy Limon
Kenzy Limon

Posted on

1

The perfect way to Writing Code Documentation

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

  1. To have better code documentation and understanding
  2. If you have a team or want public contributions
  3. 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.

  1. 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)

  2. 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)

  3. 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.

  4. 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

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay