Lurker News

Comments (222) 78 threads

Earlier comments
jvanderbot2 replies#
For me, nothing beats the mechanical calculator used to calculate torpedo firing solutions in WWII. It was a sophisticated differential equation solver that kept a real-time updated firing solution using ... gears.

There's a whole maintenance and operations manual beautifully scanned here[1]. I've wanted to build one forever, but lack the time and expertise.
1. https://maritime.org/tech/tdc.htm

bacon_waffle#
I am interested in differential analyzers too, especially after the anecdotes in Richard Hamming's Learning to Learn (aka Hamming on Hamming)[1] about re-purposing "gun directors" to solve engineering problems.

Some of the mechanisms involved are really elegant, like the torque amplifier[2] which wasn't invented until the 1920s. A tabletop demo of one is on my to-do list.
[1] https://www.youtube.com/playlist?list=PL2FF649D0C4407B30
[2] https://en.wikipedia.org/wiki/Torque_amplifier

WalterBright#
The same sorts of things were built using analog electronics.

And even these have fallen by the wayside to digital electronics.

todd8#
In college, one of my lab courses required us to learn manufacturing techniques. We covered a wide range of methods for machining and shaping things, all out of metal.

Making gears was interesting, we had to first turn a rough blank of metal on a lathe to make a steel gear blank (about 12cm in diameter and 2cm thick) then drill out the center and broach a keyway for the axle that would go through the gear. This was all pretty straightforward, but the final piece of work was more difficult, it was cutting the teeth of the gear. The teeth of a properly made gear require complex shapes.
There are, as I recall, two ways to cut the teeth. Hobbing uses a helical cutting head turning on an axis that is roughly perpendicular to the axis of the gear. The cutting head and gear turn at the same time in a synchronized manner and the teeth are eventually cut out by the cutting head. See [1] for a video of a large complex gear being made this way.
The other method, broaching, uses a straight bar of tool steel that has thick straight across cutting teeth. The bar is pushed past the disk shaped gear blank. The cutting bar moves in a straight line parallel to the axis of the gear blank. Repeated passes over the gear blank cuts out the spaces between the gears teeth.
Master machinists taught us how to make these kinds of projects. They would produce a finished gear in about 15 minutes of instruction; then we would have something like two weeks to make the gear. They made everything look easy; it definitely wasn’t easy for me.
[1] https://www.youtube.com/watch?v=0rnTh6c19HM&feature=share

TeMPOraL3 replies#
I'm going to add very little to this discussion, but it's the second article from this blog I've seen here, and - like the other one, about the Earth and the Sun - it's absolutely amazing. This is some of the finest work in "explorable explanations". I'm going to save the copy of both just to be sure to show them to my kid in a couple of years; this beats any educational material on the topic I've been exposed to before.
chubot4 replies#
It is indeed great, and probably one reason you don't see it more is that it's a ton of work! That's 5K lines of hand-written code! (view source and it's at the end of the page)

    $ wc -l gears.js base.js
     4135 gears.js
      904 base.js
     5039 total
I've wanted to make visualizations like this for my blog. Writing a blog post takes me around 10 hours, which is a fair amount of effort.

I believe that the visualizations will take more time than writing in general -- i.e. it would be more like 20 hours, bringing the total to 30.
If you consider that it's 4K lines of code (assuming the base library is reused), it's very easy to see that it could take 20+ hours. Probably more like 40-80 to be honest.
I guess there is that other thread that says people only write 10 lines of code a day, which would make it 400 hours ;) I don't think that applies here but it could be closer to 400 than 10 or 20.
----
I also wonder if you can save time by using a less "hand-written" style (e.g. d3.js, which seems to be on everyone's wishlist to learn).
My inclination is also to go "hand-written" rather than using a bunch of JS libraries. I think you get a better result that way. It's interesting to see that I'm not totally wrong -- the thing everyone praises ends up being very hand-written. And it's smooth and fast, etc.
----
another edit: I also believe one reason that this visualization is good is because there's no build process in the JS. The author clearly just edits the code and refreshes the browser. You need that kind of fast edit-view loop to make good visualizations.
IOW, consider using plain JS for blog posts. They are documents and not apps.

amitp3 replies#
Having been down this road, yes, it does take time, but you can save some time by using SVG and some DOM library. Although canvas is faster, most diagrams don't really need it, so I use SVG unless I really need to switch to canvas. SVG also adjusts for screen dpi automatically.

The things I like:
1. Reactivity (ObservableHQ, Vue.js, hyperactiv.js, etc.). There's usually some underlying data and then a corresponding visualization. These reactive systems let you modify the underlying data and then the visualization updates automatically. You don't have to figure out which diagrams to update when. Even easier: just redraw everything every time you change anything.
2. Some easier way to write the DOM (d3.js, jsx, vue, lit-html, etc.). Since I'm writing a blog post with html, I usually prefer writing my js-in-html (vue) rather than html-in-js (jsx) but try both directions and see which you prefer.
3. No build step. This is especially important when I want to update a page years later and don't want to figure out which build tools I was using in 1997 or 2007 or 2017. I want my pages to last for decades, and I still update my pages from 25 years ago.
I tried recreating one of the gear page diagrams in ObservableHQ https://observablehq.com/@redblobgames/unwind-circle-example . It's not a lot of code. There's a slider, there's a loop to generate the lines, and there's the output svg. Whenever you move the slider it recalculates the output.
I admit that I'm not using ObservableHQ much for my own projects because I want more of a "hand-written" style. I used d3.js for my older pages and vue.js for my newer pages. Vue's reactivity and templates save me probably a factor of 2 or 3 over d3.js.

kragen2 replies#
Thanks for sharing these tips! I didn't realize you were trying out ObservableHQ too.

Continue this thread — 2 replies

TeMPOraL1 reply#
Observable is amazing! Some time ago, I prototyped half of the 2.0 version of a company's product in it in a scope of a few days; that's how nicely the notebook interface and reactive programming fit together.

I didn't realize Vue can work without a build step; that's actually great. While I so far avoided using any JS on my tiny little blog, I'd really like to do some interactive explanations. I'll check this workflow out. Thanks!
Last but not least, I'm a great fan of your articles! Keep up the great work!

Continue this thread — 1 reply

chubot1 reply#
Thanks for these tips -- I've seen your visualizations and it's nice to hear from people who have done it!

It's cool that you were able to reproduce the diagram quickly and in a small amount of code. It looks a bit foreign to me, probably because I don't know much about SVG (or canvas for that matter). And as I understand it Observable is almost another language on top. (I do know HTML, CSS, and JS pretty well, but there's still a gap.)
Do you ever mock visualizations up in a WYSIWIG tool, or do you always use web technologies in a text editor?
Doing it programmatically has advantages when you need to make 30 similar diagrams, as in this post about gears.
But I also feel WYSIWIG tools could help in prototyping to avoid throwing away a lot of code that wasn't properly conceived of. That is, implementing the visualization is only part of the huge amount of work; the other part is designing it of course. And in many cases the design effort is probably larger.
For example, I have wanted to write an article about regexes, visualizing NFAs and DFAs. I find that some programmers have trouble with the idea of nondeterminism, which is more of a mathematical thing. A subtitle would be something like "A trie is a special case of a DFA".
This post has some nice diagrams, and you can easily imagine them being interactive and more approachable:
https://swtch.com/~rsc/regexp/regexp1.html
(in fact a few months ago else I posited that a textual summary of these great but dense posts would be useful too)
I can sort of imagine what I want to visualize, but I also think there will also be many false starts. Though maybe a pencil and paper is sufficient. I'm not sure I will get to it, but this polished and smooth gears post got me thinking again! Using something reactive like vue rather than doing it "vanilla JS" is also probably something I should look into as well.

Continue this thread — 1 reply

kragen1 reply#
Writing a small program takes much less effort per line than writing a large program, especially if it doesn't have to be maintainable and extensible, especially by other people. http://canonical.org/~kragen/sw/dev3/circlegrid.html only took me three hours of JS hacking, and it's like 200 lines of code. The simplified version of the basic COCOMO model in David A. Wheeler's "SLOCCount" is Person-Months = 2.4 * (KSLOC1.05), which suggests a budget of 0.44 person-months for this code, about two weeks, which is clearly too high; we've all written and debugged a few hundred lines of code in a day on some occasion after getting out of the larval stage. This probably would have been faster if I hadn't been so out of practice with DHTML.

Another thing, though, is that some things are easier than other things. Usually in a programming job you have to do the easy things and also the hard things. This brings down the average. If you're writing a bunch of blog posts for fun, though, you can just publish the ones where good visualizations came out pretty quickly and discard the others that are much more effort for less return.
I feel like visualizations using d3.js are still pretty "hand-written".

chubot3 replies#
That's true, and like everything I'm sure writing JS visualizations gets faster with practice, and you become more familiar with the tools.

Still, after finishing the article, I'm impressed by not just the the number visualizations, but by their legibility and smoothness. I can't in any universe imagine it taking less than a week of full-time work. If you told me it took a month of full-time work I wouldn't be surprised at all.
----
I liked this concept of "interpretive labor" and that's what I'm really getting at:
https://distill.pub/2017/research-debt/
There’s a tradeoff between the energy put into explaining an idea, and the energy needed to understand it. On one extreme, the explainer can painstakingly craft a beautiful explanation, leading their audience to understanding without even realizing it could have been difficult. On the other extreme, the explainer can do the absolute minimum and abandon their audience to struggle.
I've been writing for public consumption for about 3 years and really feel that tradeoff. When I put effort into some writing or explanation, the result is better. People tell me it clicked, etc.
And I would say you can go a lot further than you think in bridging the gap. This article is evidence of that! Lots of people here are saying they wished they had this in high school, etc.
3Blue1Brown's videos are another example of that. I was fairly good at math in high school but if those videos existed then, I would have probably gotten a lot further.
----
This ties in nicely to your Dercuano notes which I have had open in my browser for awhile! There are many interesting topics there. But I also feel like you went to the other extreme and there's a lot of interpretive labor involved in reading them :)
Why did you decide to polish and publish the "memory models" post? I'd like to see more posts like that. (I could send you the notes that jumped out at me if interested.) Whenever I've taken the time to polish some writing, I've never regretted it. For some reason it feels annoying to start (probably because I have to clear my brain of other things), but when I'm doing it it's fun, and when I'm done, it's worthwhile.

Continue this thread — 3 replies

1wheel1 reply#
> another edit: I also believe one reason that this visualization is good is because there's no build process in the JS. The author clearly just edits the code and refreshes the browser. You need that kind of fast edit-view loop to make good visualizations.

You can go a step further and reload code without refreshing the page. This makes it even easier to make the sort of fiddly tweaks that visualizations require while avoid change blindness.
https://roadtolarissa.com/hot-reload
https://github.com/1wheel/hot-server

kragen#
In some cases I've exposed sliders to enable a 60Hz feedback loop on those fiddly tweaks. In other cases Firebug or its modern successors already expose enough.
32gbsd#
This. The time and effort it takes to put such a visualization together for a target audience that might possibly just gloss over the content is immense. Its like making a multi-million dollar movie about people who have no money just to show thier situation. Instead of giving them the money directly. And on top of that you need all the requirements to actually be able to view it in the latest browser.
harikb#
In addition, his page lead me here http://archive.is/S01gX Start at "The little gears that couldn't." section

PS: had to archive the link because of SSL errors prevent direct access. my guess - my browser had old number of gears :P

easytiger#
I can't quite remember what the software was, but I vaguely recall something in school that we used to explore various topics in physics which used an approach very similar to this. Literate text with interactive diagrams and input variables.

It wasn't web delivered and was a Windows, perhaps Win 3.1 application. This was in mid 90s

salgernon#
This was simply wonderful, and hidden at the bottom was a link to an insect named "Issus coleoptratus"[1] which evolved something like a biological gear for synchronizing its legs.

As an almost complete aside, in Terry Pratchett's "Last Continent" there is a God of Evolution that comments on how difficult it is design a biological wheel.
“It’s very hard to design an organic wheel, you know,” said the god reproachfully. “They’re little masterpieces.”
“You don’t think just, you know, moving the legs about would be simpler?”
“Oh, we’d never get anywhere if I just copied earlier ideas,” said the god. “Diversify and fill all niches, that’s the ticket.”
“But is lying on your side in a mud hole with your wheels spinning a very important niche?” said Ponder.
[1] https://en.wikipedia.org/wiki/Issus_coleoptratus

Load more comments