This has been week six of self-exile and funemployment.
A more useful metaphor I’ve been exploring in code this week is D3 as nuclear fuel. This starts to feel a bit more helpful, because it suggests a clear approach to D3 for mortal developers: use the power, but keep it carefully contained. It’s the same line of thinking suggested by Rebecca Murphey’s argument about jQuery: “it turns out jQuery’s DOM-centric patterns are a fairly terrible way to think about applications,” leading to Tom Hughes-Croucher’s idea of pyramid code, “huge chains of nested, dependent anonymous callbacks piled one on top of another.” With great power comes great blah blah blah. Observing Dr. Manhattan offers little guidance for building a power plant.
I’m surprised at how much I enjoyed Typescript, and how comfortable it felt immediately, and how fun it’s been to bounce a free-form library like D3 against a strictly-typed language environment, like a super ball off a concrete wall. My test project is a fork of Tom Carden’s D3Map, an exercise in learning D3 for DOM manipulation and transitions. Play with it live at bl.ocks.org/4703593. You can use Typescript to write legible, self-describing code with clearly enforced expectations like Grid.ts. You can also keep the D3-needing parts carefully separated from the tile math like Image.ts and Mouse.ts. The additional structure demanded by Typescript felt surprising calming, like Allen Short’s 2010 PyCon talk on Big Brother’s Design Rules (via War is Peace):
- Slavery is Freedom: the more you constrain your code's behavior, the more freedom you have to act.
- Ignorance is Strength: the less your code knows about, the fewer things it can break. This is itself a play on the Law of Demeter or principle of least knowledge.
All of this has been a step on the way to a browsable WebGL map, one of my goals from last week.
I have also significantly updated the visual appearance of Green Means Go to make it more legible and hopefully printable.
No current progress on Metro Extracts.
This week, I’ll be doing some consulting and some future conspiracy planning. People will be visiting town, and I will have beers with them.
Re Big Brother's Design Rules - this is somthing the static-typed language communities have known all along (having discovered it the hard way over the last 50 years of programming language evolution).
Sorry, no new comments on old posts.