Company Training code specification a few days ago:
Article N:
I ++; j ++; // prohibit
Shocould be:
I ++;
J ++; // OK
Article M:
If (abool = bbool) // prohibit
Shocould be:
If (abool = bbool) = true) // OK
Not to mention how Code such as if (abool = bbool) = true is incorporated into the specification. The self-contradictory principles behind these two specifications alone indicate that this is an immature specification:
The idea behind Article N is that there is one statement per line and only one thing. Why is abool = bbool, if (abool) in Article M) what are the two completely different things to be put in one line?
In fact, I ++; j ++ is allowed to appear in a row, and if (abool = bbool) = true) cannot be allowed to appear in a row, at least the former does similar things. In fact, I think the most readable form of the former is a comma expression:
I ++, J ++; // Of course, there is no comma expression in Java
Coding standards started in the era of no smart editors and are mixed with many format requirements. Now, various automated code beautification functions allow you to organize messy code smoothly in the twinkling of an eye, to convert one style to another, the format rules in the specification should be relaxed. Besides, Java already has the official code convention, with <the elements of Java style>, if you want to develop your own specifications, you should pay more attention to the Code logic specifications. For more information, see <strong tive Java>, <practical javas >,< Java pitfalls >,< <more java pitfalls >,< Java rules >,< more Java rules>, <Java bug mode>