Their eyes were watching god.
God is change.
The wise man can pick up a grain of sand and envision a whole universe.
But the stupid man will just lay down on some seaweed and roll around until he's completely draped in it.
Then he'll stand up and go, "Hey, I'm Vine Man."
- Jack Handey
devs have two responsibilities:
getting shit done & managing/reducing complexity ☯︎
Unsure If Better To Thank AI After Receiving Answer, Or Not, To Save Electricity
[1 year later..] nty
A codebase is a journey imposed by the following:
"A complex system that works is invariably found to have evolved from a simple system that worked. A complex system designed from scratch never works and cannot be patched up to make it work. You have to start over with a working simple system"
You add features and fuck shit up.
You discover edge cases and bugs.
You massage out the bugs.
Your code is a mudball.
Sometimes you feel like a rubiks cube, sometimes sudoku, sometimes a jigsaw.
Sometimes a React component, sometimes dabbling in k8s, sometimes luxon.Interval.
Programming disciplines can magnify each other like allomancy & feruchemy.
Life before death, strength before weakness, journey before destination.
Short circuit return statements good. Indentation bad.
It's hard to debug a file that's initted by another lib
Exmample: it was hard to debug rails apps / files like config.ru or whatevs.rake because your program didn't control the entrypoint of the stack
definition monorepo: "a way to make & version atomic changes (ideally to) the entire corpus of code & config you will ever write incl maybe more like docs"
deterministic code & functions enable a reliable debugging technique - "logical bisection" similar to git bisect
"Logical bisection" = adding a bunch of
console.log(); process.exit() return <Box>JSON.stringify(whatevsH)</Box>if I were using python how could I use durToHuman() in both web fe code (lets say that needs to update 32fps offline on a <video element) & terminal output & email templates? And usable by autocomplete in 4 chracters with visual studio? Not python! Two versions of the same fnc - that's a nightmare!
Ugh I just feel dirty when I have to move a function across the client server boundary and I have to think about whether to rewrite it (+ it's dependency chain) in new lang, or make it a new property returned by an api call somewhere.
$ git add ... # Stage a fix
$ git commit --fixup=a0b1c2d3 # Perform the commit to fix broken a0b1c2d3
$ git rebase -i --autosquash a0b1c2d3~1 # Now merge fixup commit into broken commit
Always copy paste 3 letters or over.
ordinal arguments bad, named arguments good
badFnc("some name", 21)
goodFnc({persName: 'some name', age: 21})
Same goes for scripts, import a configH not 8 args
Example of bad:
listNamespacedPod(namespace: string, pretty?: string, allowWatchBookmarks?: boolean, _continue?: string, fieldSelector?: string, labelSelector?: string, limit?: number, resourceVersion?: string, resourceVersionMatch?: string, timeoutSeconds?: number, watch?: boolean, options?: {
// 🙁^
}
Allows easy mono-repo wide atomic changes of functionality.
Allows me to search for "TagSelector3 =" , "TagSelector3:" and know all the places I would have to start a hook / fork to change something
Example: Tag3Selector
I don't know why I frequently put version numbers between Words instead of at end, faster autocomplete?
peat1Symposium is a strangler fig.
Lets me moving a file with ctrl-x & ctrl v and automatically update all import paths fucking dope
Tab-to-autocomplete any exported variable or function AND ITS CORRECT RELATIVE IMPORT. Game changer. Make sure you also have a tab open with the file that exports the var / fnc you're trying to import.
Highlight which variables are unused. So much easier to spot & clean dead code.
instead of
<img src="pic.jpg" alt="a cat" style={{display: 'inline'}} />
write
<img {...{src: 'pic.jpg', alt: 'a cat', style: {display: 'inline'}}} />
then can quickly ctrl-x ctrl-v to move code around
const imgProps = {src: 'pic.jpg', alt: 'a cat', style: {display: 'inline'}}
// then can add export, maybe into client-server shared file
<img {...imgProps} />
Leveled up my fe coding - unique context definitions made fe code so much shorter & efficient to write.
Server side contexts soon??
updated: heck yes: new AsyncLocalStorage()
Q: "what is a lock?" ( if you're me my first 8 years coding )
A:
prevents this https://vladmihalcea.com/race-condition/
and the problem of "we want it to be impossible for two people to double book a stadium seat if they click the button at the same time"
And no, you can't do locks entirely w/ application code (unless it's beam based) because your prod may be running two processes on physically different machines. You need postgres or redis or something so might as well be postgres it's great.
( christmas wish: .mjs language-integrated beam features )
db transactions also super useful