Introduction
As a project gets bigger, the chances for quality issues coming up is higher. What can these quality issues be: too many bugs, too long runtime, too high memory usage, difficult to understand/difficult to modify coding style, etc. These quality issues normally make the user of your program unhappy, and the development slower. Unfortunately, you can never get rid of all quality issues, but you can avoid most of them by following the points below. Of course, these solutions cost a lot of time, but it is better to do this kind of effort in time and not lose the same time with bug fixing.
1. Analysis of Requirements
Before starting development, you need to make sure that it is 100% clear what your program should do. Here, of course, you need to think about things like compatibility of the requirements with each other or if it is possible to implement all the requirements, are there certain hardware limitations?
To be honest, most of the bugs come from simple misunderstandings: the customer had a different understanding about the functionality than the developer.
That’s why it is good to document these requirements in a clearly written form and let the customer read them and accept them.
2. Software Design
If the requirements are clear, still don’t start with the coding. First think about the solution, about how it should be implemented? Which algorithms need to be used? Which part of the code will be reusable? Which libraries could be used? How will the different components and classes communicate with each other? And so on…
With this kind of planning, you can already find and avoid a lot of possible problems in the future. Document your design in the form of text and/or UML diagrams.
3. Coding Guideline
If multiple developers are working on the same code, always have a coding guideline which defines the coding style to be used (naming of functions and variables, usage of brackets, etc.) so that your code will have a uniform style which is well-readable.
4. Regular Reviews
Do design and code reviews with other team members. They can find easily the mistakes in your way of thinking or in your code. Don’t let any piece of code be merged without a review on that.
5. Static Code Analysis
Use static code analyser tools. These tools analyse your source code without running it. They can find a lot of possible problems, like uninitialised variables, never satisfied conditions, unreachable code part and so on. They can check for coding style as well.
6. Unit Tests
Implements unit test for your code. A good unit test runs fast and tests a small piece (unit) of your code. Unit tests can help to be sure in case of every change that you didn’t break the already working functionality and they can help other programmers understand what your code is for, since from the unit tests, they can see what is the expected behaviour.
7. Component and System Tests
Don’t forget to do some higher level tests on your component or system as it is. This is basically a black box test, so you are not doing it based on the code, but based on the requirements. You can easily check if your component is fulfilling the requirements or not. Always think about corner cases as well. These tests can be manual or automated as well. Automated tests have the advantage that you can run the tests later any time.
8. Continuous Integration
Setup a continuous integration server with a CI system (like Jenkins), let it run nightly builds and check your code in case of each new change. You can integrate the static analyser and the automatised tests as well so that after each commit, you have an automated feedback if your software is working fine or not.
9. Bug Tracking
Track your already found bugs in a bug tracker system (example: Mantis). For each bug, document how to reproduce them and how it is differing from the expected behaviour. If one bug got fixed, you can shortly document the solution of the fix as well, to avoid the same kind of bugs in future. With this method, you will never forget about any bug.
10. Profiling and Memory Usage
To be able to maintain the performance of your software, you need to measure its runtime regularly. For that, you can use any profiling tool. With this method, you can also discover the part which is using the most runtime. You need to check the memory usage of your tool also. For such purposes, always try to define the scenarios which are the most difficult ones from the computational point of view.