4 ms·
> Sometimes, I can only understand something by implementing it. So, I wrote Gitlet, my own version of Git. I pored over tutorials. I read articles about intern
by caipre 12y ago
> Sometimes, I can only understand something by implementing it. So, I wrote Gitlet, my own version of Git. I pored over tutorials. I read articles about internals. I tried to understand how API commands work by reading the docs, then gave up and ran hundreds of experiments on repositories and rummaged throught the .git directory to figure out the results.
When the source itself is available, why not just read the code? I understand using articles and documentation to get the high to mid level view, but why not go to the real source of truth if it's available?
- nicholasjbs 12y agoI find reading the source of things can be incredibly helpful in some cases, but when I want to really grok something, I need to write code myself. When I'm just reading code it's easy to trick myself into thinking I understand something, but it's much harder to do that if I have to make a piece of code work correctly. Peter Seibel wrote a great post on code reading, which hits on a similar point: http://www.gigamonkeys.com/code-reading/ http://www.gigamonkeys.com/code-reading/
- caipre 12y agoI was referring more to the "ran hundreds of experiments" than the "understanding by implementing." I agree wholeheartedly that actually making something reveals far more about a problem/solution than would simply reading about it.
- makmanalp 12y agoIt's just a different approach - sometimes understanding top-down is easier than bottom-up. The git code is pretty clean and simple, but pedagogically speaking it's not super easy to get an understanding of everything without reading most of it. It's like reading a math paper where they define all the variables they use first before even getting to the main ideas. It's more rigorous, but not necessarily the most straightforward way to convey something. Also, you don't necessarily always care that something is a struct or a union or that it's implemented as a custom variant of a B+tree that does xyz or that there's this quirk on Solaris that causes filenames to be written on disk backwards or something.
- js2 12y agoAuthor addresses this: "I went to the actual source to answer a few questions. But doing that was time consuming because I don’t know C well." Also, the git source isn't the easiest code to follow.