Overview
In the process of Java project development, because of developer's experience, different code style, and lack of unified standard and management process, the code quality of the whole project is poor, it is difficult to maintain, and it needs the big test input and cycle problems. These issues will be particularly prominent in new projects where a project team is initially built, needs and designs are not fully predictable and complete. This article will combine the agile development cycle short, fast-changing features, how to ensure and improve the code quality of the entire development team by taking a series of steps in the development process, and explain the tools and best practices available at each step to make the development process more standardized, achieve high quality code, and reduce test input, and promote the skills of the entire team, and ultimately improve development efficiency and quality.
As shown in Figure 1, the agile development process undergoes requirements research, use case analysis, and use case decomposition to enter the development iteration stage. In each iteration, the following five steps can be taken to guarantee and improve the code quality of the entire project: Unified coding specification, code style, static code analysis (statics code review), unit testing, continuous integration, code review and Refactoring (Review & Refactor). The following is a detailed description of each step and the tools and methods that it uses.
Figure 1. Java Code Quality Assurance steps in agile development
Step One: Unified coding specification, code style
Uniform coding increases the readability and maintainability of project code, but it is often the case that Java code developers within a project group often have different coding styles, possibly due to differing experience habits or lack of coding specifications. As a result, it is important for other project members or maintenance personnel to spend more time reading the project code to understand the intent of the author of the code, so that a uniform coding specification is developed and adopted. Coding specifications should mainly include the following aspects:
General rules and format specifications. For example, code indentation, program block specification, maximum code length per line, and so on.
naming rules. such as package name, class name, variables, methods, interfaces, parameters, and other naming conventions
Document specifications. such as class file header declarations, class annotations, member variables, and method annotations.
Programming specifications. such as exceptions, concurrency, multithreading, and other aspects of the processing methods.
Other specifications. such as log format, property file format, return value, and message format.
Code specifications for the project can refer to some of the existing Java programming specifications books and other relevant materials and in conjunction with the project itself to develop, the books available for reference are "Java Programming style" (English title: The Elements of Java style). The coding specification is documented and concise and organizes the project members to study together to ensure that all the members understand all the entries correctly.