Control of Code Quality in Future Project Development
Everyone is probably familiar with the situation when project development runs into a wall, and introducing new functions becomes more and more costly in both time and money. Unfortunately, we’ve often lived through moments when the price scale begins to significantly outweigh the possible benefits from the implementation of any type of function.
This is a fairly standard and, in many ways, a normal course of events. As we gain more and more experience, we tend to make isolated attempts to improve the situation and avoid mistakes of the past. But, we often don’t have enough time to gather so much for organizing some kind of competent system. To date, it’s been difficult to find any kind of universal solution.
So, having analyzed many different projects, specialists at the Software Improvement Group (SIG) have developed a set of simple principles and rules, which can greatly improve this state of affairs. These principles are outlined in Building Maintainable Software, Java Edition: Ten Guidelines for Future-Proof Code (ISBN print: 978-1-4919-5352-5, ISBN eBook: 978-1-4919-5348-8).
All the elements needed to build a stable support system are surprisingly simple and easy to understand. They can be easily applied to applications of any complexity. This approach is most effective if it’s used from the very beginning of project development, especially in complex software systems. However, by using these guidelines at a later stage, you can significantly improve the performance of new modules and steadily reduce the complexity of the system as a whole.
Be bold and daring! Outline point by point the main items in these guidelines.
The importance of simple support for business companies
- The timeframe for introducing new functions is significantly smaller. The product is one step ahead of competitors.
- Bug-fixing time is greatly reduced. Both clients and customers are the final winners.
- Ease of introducing new developers into the project. Diversifying risks.
- Optimizing the system according to any other parameter requires changes to the project code.
- A well-supported code tends to work in a more orderly manner. Changes cause fewer side effects.
Implementation features
- Support is ensured by simple guidelines.
- These guidelines must be carried out from the very beginning of the project. Each developer’s contribution is important.
- Some violations are much worse than others.
List of recommendations
- Write short methods.
- Write simple methods.
- Write the code only once.
- Try to create small interfaces for methods and constructors.
- Plan your tasks according to the modules.
- Create components with weak connectivity.
- Maintain a balance between the components.
- Try to write less code.
- Automate testing and deployment.
- Write a clean code.
Some of these principles can be easily controlled in an automatic mode; special software tools have been created for languages such as Java and C#. We suggest implementing automated control for PHP development. We monitored the following basic principles:
- Functions shouldn’t exceed 15 lines of code;
- Cyclomatic complexity of functions shouldn’t exceed 5;
- Functions shouldn’t accept more than 4 incoming arguments;
- A class shouldn’t contain more than 15 methods;
Project development quality improved significantly as soon as our company introduced such controlling guidelines. The code has become much easier to understand and support.
We propose a basic solution for automatic control. The standard* is easy to build into the version control system. We recommend using it in conjunction with other stylistic standards adopted by your company.
*Will be updated soon