So this tweet: "Garbage collection helps programmers the way training wheels help cyclists. The analogy is pretty much exact." (https://twitter.com/cmuratori/status/569223413677494272)
Tobias: "is that because you consider "training wheels" insulting or because you disagree with the analogy?"
Good question. Twitter isn't terribly good at subtlety, so I don't know what Casey originally meant. Also I don't know Casey, so hard to even guess what he meant exactly. I suspect it's a bit of both: 1) "once you learn you throw away training wheels", and 2) "training wheels are for kids". I disagree with both; I think there are places where GC does make sense, even if you are an experienced programmer.
I find the "manual vs automatic transmission" analogy much better really (manual memory management = manual transmission; GC = automatic transmission). Now, I know next to nothing about cars (I do drive, but that's about it), so take this all with a grain of salt. That said, I'm not a cyclist either.
Benefits of manual:
- You can be faster than automatic (transmission | memory mgmt).
- Yeah the analogy is not terribly good wrt GC pauses.
- Generally is more economical: uses less (fuel | resources).
- You can go Manly Man on the others using automatic and say they are not real (drivers | programmers).
- Cheaper (I guess) | smaller code infrastructure.
Benefits of automatic:
- Does some of the usually boring work for you. In many cases it's one less thing that you have to worry about.
- If you're in (racing | high performance software), there are reasons why (semi)manual is used.
- While you're learning, it's massively easier (you have to learn to much all at once; one less thing to worry about is a bonus)
- Prevents you from some mistakes (wrong gear | leaks/doublefrees/...). These aren't a big problem once you have experience though.
- You can say the ones using manual are dinoaurs who know nothing about the modern world.
My point? It's a tool. Don't like it? Fine, don't use it. Like it? Fine, use it. In both cases, does not automatically mean the other side is stupid.
Note 1: Daniel's suggestion: "as with any tool, don't treat it like magic. know how it works". Which is true, but does not play well with car transmission analogy. I guess majority of drivers have no idea how transmission works (either kind).
Note 2: Tobias below makes good points about training wheels analogy. Sheet. You ruined my rant, Tobias! :)
Thanks for the write-up, man.
Fundamentally, the objection to “training wheels” as a metaphor for garbage collection feels deliciously meta to me. If you don’t particularly care about going fast on your bicycle, there really isn’t much of a reason to ever learn to ride without training wheels. You’ll get where you want to go, you’re protected against certain kinds of accidents, you don’t require a working sense of balance, and you don’t need to learn this specific skill that will cost you some amount of knee-skin before you master it. The only tradeoff is how fast you can go, and frankly the ridicule of those without training wheels.
But that’s the same as the garbage collection situation, isn’t it? The primary objection to garbage collection is either speed or shame.
We can even take this metaphor a bit further: As someone who’s lived in Cambridge, I’ve seen plenty of people with either elevated blood alcohol or exciting conversations fall of their bicycles. It would never occur to them to attach some training wheels to protect themselves, because that’s just not what a self-respecting adult would do.
In the same way, I’ve seen people go C-with-intrinsics where a python script would suffice.
Anyway, here’s a picture of a Honda Goldwing with training wheels: http://www.bikerplaza.com/image/bikers/Honda-Goldwing-Aspencade--98-315.jpg ;)