Do you have any good experience on how to write good notes?

background:
currently working on a Java server project, all Controller,Service,Dao,Entity are required to write comments with standard Javadoc

@Controller
public class LoginController{
    
    @RequestMapping(value = "/login")
    public void login(String account, String password){
    
    }
    
}

I think that for the above method, you can see what you are doing at a glance. There is no need to write comments at all, and writing comments is nonsense

but for the whole project, we need to write the whole code like this

/**
 * 
 * @author xxx
 *
 */
public interface LoginService{
    
    /**
     * 
     * @param account 
     * @param password   
     * @return 
     * @author xxx   
     */
    User login(String account, String password);
}

it is understandable if the whole project follows the specification. But most of the time, we only maintain the code, but not the comments , resulting in comments being misunderstood

so most of the time, I have a confusion about how to write the right comments , so that the comments do not become obvious nonsense, masking the real code intent. People who can quickly know the true intention of the code

do you have any good experiences, methods and techniques to share?

Mar.08,2021

I think writing comments requires the team to have a set of standards, and then it depends on everyone's self-awareness.


our company uniformly uses the "Ali coding specification" plug-in, if there are no comments, IDE will prompt and give you a demo example to tell you how to write comments; in addition, there are many other code specifications tips, you can try to use this plug-in uniformly.
installation tutorial: [ https://blog.csdn.net/fuzhong.]

clipboard.png


I think comments are not a reinterpretation of the code. If comments are complex, then your code is likely to have problems.
writing good comments is much like writing a resume. What do I need, what is my purpose, what I want to accomplish in certain situations, what must be done, and what must not be done. I think it's easier to write beautiful comments than to write beautiful code

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3759d-410c9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3759d-410c9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?