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! :)
I agree with both analogies, I think they're fairly close on target. One may argue on a more detailed level as to which of two analogies is better.
But I'd like to expand the analogies in another direction.
Consider concurrency/parallelism/multithreading. Suppose your target machine has 16 threads (maybe 8 physical, 16 virtual) or even more, which is a likely situation in the coming future/present.
I would say that each car/bike represents a single thread at your disposal. So now you have 16 cars/bikes.
Personally, at this point, I would prefer the 16 cars/bikes to have automatic transmissions and training wheels, because it's really hard for me to control all 16 cars at once if I also have to worry about manually changing their gears. It's also nice that the bikes with training wheels do not tip over when they come to a stop, which may happen when I get distracted by so many of them. After all, I'm only one person (programmer), having to control/drive so many things at once.
Well, that's my take on things. I think I'm okay with giving up some of that control if it saves me time/concern and frees it up to worry about using up all the cores in my target system. But if I wanted one core to go really fast, there's no doubt I'd opt for the manual transmission or bike without training wheels.