-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Axioms of AJ #28
Comments
"return something, or return nothing"
Bad Examplesif (x) {
return res.json(x);
} function runJob() {
return otherWiseUnusedPromisableThing()
} This axiom was intended to apply at the language level, but it also serves at the framework level. This is bad: res.json() Good Examplesif (x) {
res.json(x);
return;
} async function runJob() {
await otherWiseUnusedPromisableThing()
} res.json({ success: true }); |
"let errors bubble, until they burst"
Preferential order for dealing with errors: 1. Correct the mistakeEx: 2. Classify the errorEx: 3. but do NOT CatchDon't catch uncorrectable errors locally. Let them bubble up. Ex: Bad Ex: try {
oops();
} catch(e) {
/* silencing because not sure what to do here */
} |
"limit usefulness"
One of the human assets that becomes a real problem when programming is that we can find anything useful - even when it's not for its intended or optimal use. So much so, in fact, that we have an entire area of study dedicated to it - it's called "Art". Instead, I argue for the RISC (Reduced Instruction Set Computer) principle - less mental burden, fewer edge cases, etc. |
Work In Progress
Words that resonate through the halls of the Zen of Python, the Go Proverbs, and other Creeds of Craftsmanship...
Need a more succinct way to say "We did what we always do when there’s a problem without a clear solution: we waited. Waiting gives us more time to add experience and understanding of the problem and also more time to find a good solution." - Toward Go 2
"return await, or await without return"
Omitting the
await
as a shortcut is cute, but likely to lead to bugs when you need to refactor later on:vs
The text was updated successfully, but these errors were encountered: