Be a lifelong learner.

One of the things that every programmer prides himself on is writing strong, beautiful, clean code. If you had those three more, your code would soar.

First artifact: IntelliJ IDEA





IntelliJ IDEA

Many people reject this artifact because it is charged, and the price is not cheap. But I think it’s a good buy. Many people are still uncomfortable with the idea of paying for legitimate software, but you should change that.

My view on software products: support Copyrights, resist piracy, encourage open source, and you are a great programmer.

This is a bit of a digression. Instead of mentioning other features of IDEA, here is only one use:





Inspect Code

When you have finished writing a Java class, or one of its functions, right-click in the class and select Analyze -> Inspect Code, as shown in the figure above. After clicking, the following interface will appear:





Specify Inspection Scope

I always default, and I hit OK,





The results of the analysis

I have done this analysis on a random class, and while your results may differ from mine, focus on Probable bugs, which may be hidden in the program. Other options are handled according to their own scenarios.

Here’s what I did with the tips:





Improved reconstruction results

Does it feel very comfortable? The latter two tools, checkstyle-IDE and FindBug-idea, are integrated into IDEA as a plugin. They also have versions of Eclipse. This is mainly used in IDEA.

Second artifact: FindBug-ide

This plugin is used for potential Bug checking, which is similar to the “Inspect Code” function above, but they complement each other and add another layer of security to the Code.

For how to install the plug-in, see the screenshot. After installing the plug-in, you need to restart IDEA.





Plug-in Installation Process

Findbug-idea is used as follows: right-click on the Java class you want to check:





FindBugs

Then check the results, the left side is the specific possible problems, the right side is to give detailed instructions.






FindBugs checks the results

Third artifact: Checkstyle-IDE

Checkstyle-ide is also a plugin in IDEA, it is mainly used to Check the code specification, specific use is also very simple, to Check the class right click, select “Check Current File”.





CheckStyle

In the Rules drop-down box, select the test rule you like,





Rules

When you’re done, click the green triangle button on the far left:





Check the result

Can be based on your actual situation, the most results of the analysis, and finally to adjust the code accordingly.

In fact, in these three tools, do not spend too much time, mainly to check their own code, see if there are some of their own did not think of, or there are potential problems.

Ok, the above three tools are the three magic tools I said, I always believe:

To do a good job, he must sharpen his tools.

So, in the internal skill is still pretty good, choose their own tools, will let your “martial arts” advance by leaps and bounds.