Use eclipse V3.3 to keep your code clean

Source: Internet
Author: User

Clean, Easy-to-read code enables developers who are unfamiliar with the program to understand the program quickly and completely, making software maintenance more efficient than other methods. Understanding the new cleanup features in the Eclipse V3.3, Eclipse V3.3 provides developers with more options for cleanup than earlier versions.

Writing clean code helps other developers read, understand, and maintain the code you write. However, not everyone agrees with the definition of "beautiful", "precise" or "clean". The different developers have different styles and aesthetic tastes. So far, Eclipse has set the format of the import code in a simple functional way with a few adornments. These operations are extended in Eclipse V3.3 to provide a broader level of cleanup functionality. Eclipse V3.3 allows you to clear code, add missing code, and apply some encoding style. The wizard will help you configure the cleanup settings and store them for later use.

We will discuss the basic concepts of cleanup and provide an overview of the tools that will help keep the code clean.

Managing cleanup configuration with a configuration file

A specific cleanup configuration is referred to as a configuration file. Profiles can be saved so that you can provide settings to others or apply settings from earlier projects and others to the current code. Depending on your organization's coding conventions, the configuration file can be applied to all Eclipse projects, so that you can get the same code style across all development teams.

The Eclipse preferences provide administrative functionality for the configuration file. Configuration files can be created, edited, and deleted. You can specify the configuration files that are used globally in the workspace. When you first open the workspace preferences and browse to the Java > Code Style > Clean up, you will see the active profile Eclipse [built-in]. This built-in configuration file has been preconfigured and delivered with Eclipse. There are two built-in configuration files: Eclipse and Save Participant. These two configuration files define two minimum cleanup configurations, which basically remove unnecessary code. You can view the settings for these built-in configuration files by setting them as active profiles. All details are shown in the details area.

Figure 1. Built in details

Existing profiles can be used as a variety of templates and can be extended and customized. Therefore, select an existing configuration file from the Drop-down menu as the active profile and click Edit. The built-in configuration file cannot be changed. You can use the built-in configuration file as the basis for your own profile or simply apply the built-in configuration file as-is to your code.

To create your own profile, click New. Initialize the configuration file by naming it and selecting an existing profile from the Drop-down menu. Uncheck the Open the Edit dialog now and click OK.

Figure 2. New configuration file

Related Article

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.