Open
Description
An Expert's Guide to Navigating JavaScript in the 22nd Century
Work In Progress
Words that resonate through the halls of the Zen of Python, the Go Proverbs, and other Creeds of Craftsmanship...
0. Limit usefulness
1. Don't Make Waves
2. Less Magic in Code, More Magic in Tooling
3. return something, or return nothing
4. return await, or await without return
5. let errors bubble until they burst \
(Correct or Classify, but do not Catch)
6. Gatekeepers at the gates, Doorkeepers at the doors
7. Interfaces over Generics
8. No worthless abstractions \
(_Abstractions should be deep - John Ousterhout_)
9. But by the 3rd or 4th time, you should know what it is
10. await catch: Don't trade one pyramid of doom for another
11. It's easier to read from top to bottom than left to right, or right to top \
(return early)
12. Optimize for the happy path (not for exceptions)
13. _When it is broken, it is the right time to fix it - Chinese Fortune Cookie_
14. The constraint of the medium defines the Art \
"Anything goes" is _not_ a workable constraint
15. For every metric, a counter metric
16. If it sounds cool, DON'T DO IT 🚨!
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:
return fetchResponse.json()
// becomes
let data = fetchResponse.json()
data.foo = 'foo'; // ❌
return data;
vs
return await fetchResponse.json()
// becomes
let data = await fetchResponse.json()
data.foo = 'foo'; // ✅
return data;
Metadata
Metadata
Assignees
Labels
No labels