From e150b300ee5ae98b71a78810569843b9f6a4ba06 Mon Sep 17 00:00:00 2001 From: Alex Kladov Date: Thu, 11 Jan 2024 14:12:47 +0000 Subject: [PATCH 1/2] style: main on top --- docs/TIGER_STYLE.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/TIGER_STYLE.md b/docs/TIGER_STYLE.md index 25ebdf5c0b..77bb112555 100644 --- a/docs/TIGER_STYLE.md +++ b/docs/TIGER_STYLE.md @@ -268,6 +268,13 @@ Beyond these rules: * Callbacks go last in the list of parameters. This mirrors control flow: callbacks are also _invoked_ last. +* More generally, _order_ matters for readability even if it doesn't affect semantics. On the + initial scan, a file is read top-down, so put important things near the top. The `main` function + goes first. + + At the same time, not everything has a single right order. When in doubt, consider sorting + alphabetically, taking advantage of big-endian naming. + * Don't overload names with multiple meanings that are context-dependent. For example, TigerBeetle has a feature called *pending transfers* where a pending transfer can be subsequently *posted* or *voided*. At first, we called them *two-phase commit transfers*, but this overloaded the From a68f5291203f8d7459e6d7edb2f5790e8e27a68c Mon Sep 17 00:00:00 2001 From: Alex Kladov Date: Tue, 16 Jan 2024 15:33:12 +0000 Subject: [PATCH 2/2] Update docs/TIGER_STYLE.md Co-authored-by: Joran Dirk Greef --- docs/TIGER_STYLE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/TIGER_STYLE.md b/docs/TIGER_STYLE.md index 77bb112555..4d309d7926 100644 --- a/docs/TIGER_STYLE.md +++ b/docs/TIGER_STYLE.md @@ -268,8 +268,8 @@ Beyond these rules: * Callbacks go last in the list of parameters. This mirrors control flow: callbacks are also _invoked_ last. -* More generally, _order_ matters for readability even if it doesn't affect semantics. On the - initial scan, a file is read top-down, so put important things near the top. The `main` function +* _Order_ matters for readability (even if it doesn't affect semantics). On the + first read, a file is read top-down, so put important things near the top. The `main` function goes first. At the same time, not everything has a single right order. When in doubt, consider sorting