Please, comment your code...
Tags: productivity, discuss, tutorial, vscode
Published: 2022-10-02 00:52:30

## Why should I comment my code ?

If you're actually code in Java, JavaScript, Python, PHP. You're probably hear about technical documentation and some things like :

- [JavaDoc](https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html)
- [JSDoc](https://jsdoc.app/)
- [DocString](https://peps.python.org/pep-0257/)
- [PHPDoc](https://www.phpdoc.org/)

And if you had not heard anything about "how to comment your code". So you were, you are or you will be confronted to THE question : 

"*What this code do ???*"

And you know how it's painful when something doesn't work and you can't understand WHY !

![Rage developer](https://media2.giphy.com/media/ik10lqhr0HTUc/giphy.gif?cid=790b7611dad632c5bd948dd23b5953c627afdb6c9db30c81&rid=giphy.gif&ct=g)

When you use an external program, your reflex is to read documentation about this program to understand how to use this.

When you comment your code, the objectives is the same. You'll write some details for you in the future or for the people who use or improve this code.

### Objectives

The objectives is multiple, just think about you in 2 years in this code. You'll be happy to see somes comments who explain what is this weird classes you added before 😆.

Now, if you don't code alone. Think about you're associate will read and use your code.

And PLEASE, think about all people who use your code in the future if you're make an open source program.

---

I think you understand now, when you comment your code you actually :

1. You **saves time** for you, and for other peoples
2. Describe, and have a **readable code**
3. Your code will be **accessible**

## When should I comment ?

It's recommended to comment your **class**, you're **function** and use **inline documentation** when is necessary. I think it's the minimal requirement for a readable code.

A code has commented, is a readable code. **BUT**, use comment whith thriftiness.

> Of course, if you're function is named `sum` for example, and take two arguments. It will be really simple to know what the function do.
> Personaly I think you should comment for function when the function is over 10 lines, and it's required for classes.

And please remember, a developer does not only code. 

A developer maintain, debug, keep an eye on evolution, document, and think how to resolve problems. 
So please, comment your code and make happy the "you" of tomorrow and all people who read your code. And you'll make a step to become a programming god 😃.

![God developer](https://media0.giphy.com/media/CXnj3jCwvETngjy11B/giphy.gif?cid=790b76113b8a42da37b27a4555a248ec931afe31a9ddc04b&rid=giphy.gif&ct=g)

---

Tell me if you have any suggestions, or remarks and of course if this article was interesting.
There is so much to say about this, feel free to express your point of view, so don't hesitate. 😜

<div align="center">
<a href="https://www.buymeacoffee.com/tykok"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a sushi&emoji=🍣&slug=tykok&button_colour=5F7FFF&font_colour=ffffff&font_family=Cookie&outline_colour=000000&coffee_colour=FFDD00" /></a>
</div>