If we want to inject soul into the program , Using annotations is undoubtedly the quickest way .

You want to make complaints about product manager? , No, on the face of it , But I'm so depressed , It's not the way . That's ok , Write it in the notes .

 

 

 

Or use a sentence , Euphemistically express the meaning of the whole page .

 

 

 

If you use e-resume , A requirement that you want to obscure , Can learn Google Co founder Sergei · Brin , Pursue your true career :“ More money, less work, bigger office, more frequent overseas travel and reimbursement ”, Written in code comments .

 

 

 

In the formal work , Programmers hate comments , They hate it :

1. Write notes , Write document ;

2. Others don't write notes , Do not write document ;

Even if someone wrote a note ,90% Notes for , They all look like this :

 

 

 

Just finished , You don't need to read the notes ;

A week later , What does this cat do ?

One year later , Why is there a cat here ?

Five years later , Who pulled this cat shit ?

Annotation is the soul of program , But most programmers , You can't write good notes , Or add to the cake , And even your pick-up man .

As a qualified programmer , How to write good notes ?

stay 《 Code Complete 》 in , Divide notes into 5 Categories .

1. Code repetition

Use different words , Restate the content of the code

2. Interpretation code

Explain more complex code , This type of code , Often through code optimization , Make the code itself clearer . of course , Schedule priority , This kind of code is necessary , Good for future maintenance .

3. Tagging notes

// It's necessary to make an optimization here

// It's not finished here

Experience shows that , If you write like this , Generally speaking , You won't do any of these things . These things , Code should be submitted before , Just finish it .

in addition , It is better to add some key information to such comments , Such as name , date , contact information , Prompt, etc , convenient grep.

4. Summary code

Summarize a whole piece of code into one or two sentences , Such comments , Can help others understand the code quickly .

5. Intent of the code

Explain the purpose of the code , What was the original programming intent , What problems are you going to solve ?

only “ Summary code ”,“ Intent of the code ” These two types of annotations are the most effective , It is also the most effective form of annotation .

To put it another way , Summary code , Comments that represent the intent of the code , It's a really good note .

The notes are simple //,<!-- -->,/* */, How to write every programming language , It's very simple , But I want to write notes , Still challenging .

Technology
©2019-2020 Toolsou All rights reserved,
JS How to operate java Realize the function of grabbing red packets C Language programming to find a student's grade The United Nations 《 Glory of Kings 》 Please go to the studio : To save the earth Dialogue between apple and Nissan suspended ,Apple Car How's it going ?CSS architecture design China's longest high speed rail officially opened ! The fastest way to finish the race 30.5 hour First knowledge MySQL Comprehensive review ( dried food )2021 year 1 Monthly programmer salary statistics , average 14915 element How to use it quickly html and css Write static page