Appendix D — Developer guide
What you will learn
- Find your way around the program's source: four layers, the modules in each, and the three structural rules that keep it checkable.
- Follow one command from start to finish, and see the contracts it keeps: one failure type with a stable exit code, one settings system, one output set, one random-stream rule.
- Make the common changes (an option, a check, a command) without forgetting the places they must appear.
- Write the tests that protect the program's promises, and run the gates that stand between a change and a release.
- Make a release: the number, the change-log entry, the documentation, the archive and the report.
Prerequisites: Chapter 4, concepts and conventions, and for the testing pages Chapter 42.
This appendix is for the person who maintains the program or reviews a change to it. It describes how the program is organised and why, at the level of layers, modules and contracts. It is not a language tutorial and it does not give build commands: users of the program receive it compiled, and the appendix is about the decisions a maintainer takes, not the tools used to take them. It does not quote a current or past release number, because the numbers are in the change log and a book that copied them would be wrong at the next release.
Every statement here describes the structure of the program as it stands and the rules of the project. Where a page gives an illustration (an option called --max-findings, a command called summarise), it is marked as a worked illustration and is not part of the program.
The idea in one paragraph
A pharmacometric result is only useful if it can be traced to the program that made it. Everything in the developer rules follows from that sentence. The program has one way to fail (a code, a message and a hint) so that scripts can act on a failure. It has one settings system so that a run can be repeated from a file. It has one output set that ends with a checksum list, so a folder can be verified. It has one rule for random numbers, so a result does not depend on the number of threads. And it has one release rule, so that a number identifies exactly one program. The pages show how a change keeps all five.
Start here
- Reading the code for the first time? D.1, then D.2.
- Writing your first change? D.6, then D.11, D.14 and D.16.
- Adding a data check? D.7.
- Adding a command? D.8, after D.2 to D.5.
- Reviewing someone's change? the checklists at the end of each page, collected in the developer reference.
- Preparing a release? D.13, D.15 and D.16.
Pages in this appendix
| Page | Topic | Figure |
|---|---|---|
| D.1 | The code map | four layers |
| D.2 | One command from start to finish | three stages |
| D.3 | Errors, exit codes and the failure record | exit-code table |
| D.4 | The settings system | four artefacts |
| D.5 | Outputs, logging and determinism | three promises |
| D.6 | Adding an option | eight places |
| D.7 | Adding a check | catalogue entry |
| D.8 | Adding a command | fifteen items |
| D.9 | Keeping everything in step | three grades |
| D.10 | The test layers | four layers |
| D.11 | Writing an end-to-end test | anatomy |
| D.12 | Determinism, resume and the guard | three tests |
| D.13 | Every change is a release | request to release |
| D.14 | The documentation checklist | ten places |
| D.15 | The gates | five gates |
| D.16 | Packaging and handover | archive, commit, report |
The developer reference collects the code map, the exit codes, the test helpers, the release rules and every page's review checklist in one place.
The appendix has 16 numbered pages, this overview, and the reference: 18 Markdown pages in total. Continue with D.1.