How well Review own code

Source: Internet
Author: User

The reason for writing this blog post is because the code you write is often due to rework, delay the delivery date of the project. Summarize the cause of the delay of the project, probably the following points:

    1. In the absence of complete familiarity with The requirements interaction details , such as setting different order status changes based on different channels-timeout reminders and order cancellation functions .
    2. In the absence of a clear idea of how your code implements business logic, such as scheduling and scheduling details at the end of the current cycle, such as the rider scheduling .
    3. Is there a complete test case for the business logic, the merchant details permission function, and the test case for the reversible encryption algorithm .

Often the first and second steps occur at the same time, and the second step arises largely from the understanding that the details of the requirements interaction are not in place, so the habits we develop in development should be:

    1. A careful look at the needs analysis, it is best to retell the requirements of the details, the idea of how the code to implement the logic.
    2. Communicate with the product manager and the front-end engineer, test engineer to communicate clearly the requirements of interactive details.

of course, the above summary is also the theory, we should take this as the guidance in the development, slowly develop good development habits. use of annotations. When working with others to develop a function, it is likely that because of the name of the method, write a repeating method, in the code review, you can add @deprecated annotations on the method, indicating that the method is obsolete, when an application calls the method, it will error.

1<!--annotation usage examples--2 3  Public classAnnotationtestextendsTest4 {   5  6@SuppressWarnings ("Deprecation")7       Public Static voidMain (String []args)8      {   9       Ten<!--This sentence is a procedural order. The action is to run garbage collection when the program ends-- OneSystem.runfinalizersonexit (true)  ; A SayHello (); -Annotationtest t=Newannotationtest (); - t.show (); the      } -  -<!--Use this method on the method, you will get an error when using this method - @Deprecated +       Public  Static  voidSayHello () -      { +System.out.println ("Hello, world!"); A      } at   - @Override -       Public  voidShow () -      { -System.out.println ("Super class"); -      } in   - } to  +  -  Public classTest { the @Deprecated *       Public  voidShow () $      {Panax NotoginsengSystem.out.println ("Super class"); -      } the}

The above is an example of using @deprecated, @SupressWarning, @Overrider three annotations, annotations will be recognized by JAVAC, parsed into the annotation class , the compiler will compile different results according to different annotations, @ Deprecated annotations represent obsolete methods that occur when using methods in the lower version of the JDK, and @SurpressWarning ("deprecation") annotations are warnings to suppress outdated APIs. This can be placed outside the method that calls the outdated API or before the method is called, then Javac encounters this identity at compile time, even if it knows that the API is outdated and does not output outdated API hints.

1<!--usage frequency 80%-->2Alt + '/'Code Hints3Sysout + Alt + '/'Auto-complete "System.out.println ();"4  Public voidAnnotationtest double-click the class name annotation, click Run as->Java application, that is, you can run the test class5CTRL + '/' adds a comment "//" to the line where the cursor is located, no need to select the line beforehand, uncomment the CTRL + '/'6CTRL + SHIFT + '/' Add comment "/* * *", need to select the line beforehand, uncomment using CTRL + SHIFT + ' \ '7CTRL + SHIFT + ' C ' Add multiline comment "//", uncomment also use CTRL + SHIFT + ' C '8Ctrl + ' D 'Delete current row9Ctrl + ' M 'maximizes and minimizes the IDE window where the current cursor is locatedTenCtrl + ' L 'jumps to the specified number of row labels entered OneCtrl + Shift + ' T 'find the specified class name within a workspace ACtrl + Shift + ' O 'use caution, because sometimes the import package is not the package you need -ALT + ' <-' and ALT + 'track the previous and next position of the cursor -  theAlt + Shift + ' J ' adds a comment that makes it easy for Eclipse to generate API documentation

Report:

  1. Eclipse installs the eye protection color theme, you can open the Help, Eclipse Marketplace search Eclipse color theme for installation: After installation, you can install it in the (window->preferences- >general->apperance->color Theme) found the color theme plugin settings interface, where you can choose your favorite theme according to their preferences.
  2. Three ways to set the comment label @user in eclipse: First, add a-vmargs-duser.name=sun, Wu-kong in the Eclipse.ini in the Eclipse installation directory, and the second, through the menu window-> Preference, Java, code Style, code Templates, on the right, select comments, place the types item in it, and then select "Edit" on the right to enter edit mode, which will @author ${user You can change the ${user} to your own name, and the third, the computer--and the local Users and groups--user, log on with the administrator account to change the user name and restart the computer.
  3. How the project in Eclipse generates the Javadoc document, right-click in the project list, select Export (Export), and in the Export dialog box, select Javadoc under Java, submit to next, in Javadoc There are two places to note in the Generation dialog box: Javadoc command: You should select \jdk1.8.0_31\bin\javadoc.exe,destination in the native installation JDK path: To create a save path for the document, Freely selectable, press Finish to submit and start generating the document. You can then see the console console output.
  4. More Shortcuts Reference: http://jingyan.baidu.com/article/c275f6bac8e43ae33d756716.html

How well Review own code

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.