This controller is intentionally written in a very verbose style. You will notice:
1. Every 'if' statement has a matching 'else' (exception: simple error checks for a client API call)
2. Things that may seem obvious are commented explicitly
We call this style 'space shuttle style'. Space shuttle style is meant to ensure that every branch and condition is considered and accounted for - the same way code is written at NASA for applications like the space shuttle.
----------------------------
^^^^
This bit reminds me of exhaustive checks in typescript code. I try to use them all the time.
----------------------------
This controller is intentionally written in a very verbose style. You will notice:
1. Every 'if' statement has a matching 'else' (exception: simple error checks for a client API call)
2. Things that may seem obvious are commented explicitly We call this style 'space shuttle style'. Space shuttle style is meant to ensure that every branch and condition is considered and accounted for - the same way code is written at NASA for applications like the space shuttle.
----------------------------
^^^^
This bit reminds me of exhaustive checks in typescript code. I try to use them all the time.
https://www.typescriptlang.org/docs/handbook/2/narrowing.htm...