Principles of quality software development Mark McIlroy June 2022 1. Write a small section of code and test it, write another small section of code and test that etc. Do not attempt to write a large section of code before starting testing. 2. Try to use integers for your keys and direct array lookups, instead of strings which require searching. Your code will be orders of magnitude faster. 3. Extensive testing is required to develop a quality system. 4. Once a section of code is completed and working it is not finished. It is beneficial to spend some time going over the code to improve it. 5. Keep your functions/subroutines short. Functions should be limited to 20 to 30 lines of code. If you take a function of 100 lines of code and break it into three functions of 30 lines each, you will probably see multiple ways to simplify and improve the code immediately. An exception to this is a function containing a switch/case statement with a large number of case entries where each case entry is only a few lines of code. 6. Add new concepts to the code to make it faster, smaller, more stable and more flexible (e.g. new data structures, algorithms and models such as internal to the system languages). For example add a new data object with methods that is specifically suited to the aim of the code, or a new algorithm. In a simple reporting application example add a 'account set' object to a report and print the income accounts set, expenses accounts set and net profit set rather tha writing a single report. In a systems level example, create an internal mini-language and output statements in this language from the first part of the application to the next part. [Point 1 - three sections of code with 12 'if' statement each has 2^12*3 = 12,288 paths to test, but if you wait to test the entire block there are 2^36 = 68 billion possible paths. It is possible to test a much greater proportion of the paths using the first approach.]