Readable Code VS Code Comment
Personally I would say that readable code and code comment goes hand in hand together to make simple code. However there are people who like to take them to the extremes. So…
Readable code is useful because:
- Using high level language, it is almost like reading a book.
- No need to write code comment because the code is clear.
- The code is self explanatory.
- It is not always possible to write readable code. Try writing readable code is Assembly language.
- It requires consistency.
Code comment is useful because:
- It explains the logic behind the code
- It explains why a particular solution is chosen
- Code comment takes up space in the code.
- Excessive comment can lead to the comment not being read and it blurs the code.
Now, I believe both have its advantage and disadvantage. They each have their own purpose.
So, they should be used together.
Remember that both are used to help developers understand the code.
What do you think ?