Java: superfluous coding specifications

Source: Internet
Author: User

 

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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.