Notes should not be over

zhaozj2021-02-08  246

I am a classmate, saying that every code of your own code is comment, and it is proud of this.

In fact, what is the purpose of comment? It is possible to understand the procedure for others to take over the program; or after a long time, help you memorize yourself.

I don't know how many programmers are now designed for programs before starting writing code. It is clear that the clue is knocking on the keyboard, or no matter what three seven twenty eleven, write, then deal with it, desperately change ...

A well-designed code context is clear, the module is reasonable, and the logic of each module is simple enough. Reading this code is just as smooth as reading novels, the code itself explains everything! The annotation is exactly more, and the snake is added!

Have you seen such a novel? Every side is added to a piece of text, indicating what this novel wrote (except the comment). The novel only has an outline introduction.

The same is true, does not need to comment on the code, just a description of a module.

If you think that you don't know the level of "good design", you can write some annotations, it doesn't matter, but don't use this, let yourself have a direction of efforts, always don't have any comments, design and bad Much more.

In short, excellent design good code style = less annotation

When you find that you have to write a lot of comments, it is the time to check if you design is reasonable.

转载请注明原文地址:https://www.9cbs.com/read-2051.html

New Post(0)