| 1. Keep control flow simple | Rule 1: simple control flow, with no goto, setjmp, longjmp or recursion. | Simple, explicit control flow, and no recursion. | We name the case that tempts database engineers most: walking a tree. |
|---|
| 2. Put a limit on everything | Rule 2: every loop has a fixed upper bound that a tool can prove. | Put a limit on everything, because everything has one. | We extend the bound to retries and in-flight I/O, and require back-pressure. |
|---|
| 3. Allocate memory at startup | Rule 3: no dynamic memory allocation after initialization. | All memory is allocated statically at startup. | We require it on read and write paths. Planning and setup code may allocate. |
|---|
| 4. Keep functions under 70 lines | Rule 4: no function longer than a printed page, about 60 lines. | A hard limit of 70 lines. Decisions move up, loops move down. | We keep TigerStyle's number and its advice on how to split. |
|---|
| 5. Assert what must be true | Rule 5: at least two assertions per function, with a recovery action. | Assert in pairs: check the same property on two code paths. | We separate programmer errors, which assert, from disk errors, which return. |
|---|
| 6. Keep every value close | Rule 6: declare data at the smallest possible scope. | Shrink scope, and do not duplicate or alias variables. | We apply it to stored facts too. A cached count needs an owner. |
|---|
| 7. Handle every error | Rule 7: check every return value and every parameter. | All errors must be handled. | We add the durability promise: no acknowledgement before a confirmed sync. |
|---|
| 8. Make every byte explicit | Rule 8: limit the preprocessor, so code means what it says. | Use explicitly sized types, and watch for buffer bleeds. | Our largest change. We move the idea from hidden code to hidden bytes. |
|---|
| 9. Name pages, not addresses | Rule 9: one level of dereference, and no function pointers. | Do not alias variables. Construct large structs in place. | We turn pointer discipline into page discipline: IDs and pins. |
|---|
| 10. Let machines check it daily | Rule 10: all warnings on from day one, and daily static analysis. | The strictest compiler settings, with the VOPR simulator as a final check. | We require replayable seeds, so a newcomer can reproduce any failure. |
|---|
Write comments in standard technical English
Our readers speak many first languages, and some will read your comment in the middle of an outage. Say why the code is there, in short sentences with one meaning.
// increment retries// off by one??// wait a bit for disk// page is released// put block in slot, then pin buffer// here be dragons, don't touch6 problems
basicallyStart with a capital letter.soonEnd with a full stop.fastGive a number, a unit or a name.basicallyDelete it. The sentence means the same without it.magicUse the literal term. Not every reader knows the idiom.are flushedSay who does it, in the active voice, if the actor matters.Inspired by ASD-STE100 Simplified Technical English, the controlled language for technical documentation, and by TigerStyle, where comments are sentences that say why. This is our own short version. It does not claim STE conformance.