Reflections on 10k Hours of Programming
Good post, and a good list. Here&#x27;s a mind dump on some of the items:<p>Right off the bat:<p>&gt; Well, I&#x27;m certainly not a world-class expert, but I have put my 10,000 hours of deliberate practice into programming.<p>Okay, I don&#x27;t know the authors exact history here, but I <i>seriously</i> doubt that they&#x27;ve had anything that&#x27;s even close to 10k hours of <i>deliberate practice</i> of programming. Why? Because programmers basically &#x2F;never&#x2F; do any deliberate practice. We don&#x27;t have anything that&#x27;s even close to what a piano player does when they practice fingersetting, chord transition, scales, or the like.
I&#x27;m not even sure what this would look like, but I suspect that it is fundamentally different. Most musical instruments have a physical or mechanical side to them that is completely disjoint from the &quot;musical&quot; part of it.
For instance knowing how to play a cool solo a guitar (meaning knowing which notes to pick and how long to hold them for), and being able to have your left hand fingers in the right positions in the right times and your right hand picking the right strings has almost nothing to do with each other.
The way it usually works (I&#x27;m an amateur player who hasn&#x27;t played in years, so maybe some professionals can take over this analogy) is that you practice very slowly and ramp up quicker and quicker untill &quot;magically&quot; your muscle memory takes over and it all kind of just happens.
The result is that you don&#x27;t really pick each indivitual note anymore, you kinda just play that part (when practicing you&#x27;ve decomposed the whole piece into small parts), and each part is atomic to you. Starting in the middle of a part doesn&#x27;t quite work.<p>The only programming analogy I can think of (from the top of my head) is how effortless it feels to write `for (int i = 0; i &lt; n; i++)`, or something like it. But we only spend a negligible time on actually writing out the lines of code when programming, so while being able to effortlessly write out a bunch of standard `for` loops doesn&#x27;t really push the needle in any way.
For a performing musicial, of course, this is very different, because the &#x2F;have&#x2F; to play it right! Imagine having to write all your `for` loops in sync with the beat of music.<p>&gt; 4. Syntactic sugar is usually bad.<p>It&#x27;s hard to really get exactly what this means, because if taken literally it is obviously not true. Pretty much any loop or control flow structure is just syntax over goto, but I assume the author doesn&#x27;t really think we should manually write out the gotos. Having recognizable patterns in a codebase is good. Cramming in some esoteric syntax quirk of your language into your code because it technically fits is not good.<p>&gt; 5. Simple is hard.<p>Again, difficult to get something concrete out of this since it reads as a zen mantra. If they mean that finding a simple solution to a difficult problem is hard then I agree. If they mean that a system being simple means it is hard to use then I disagree.<p>&gt; 7. Know the internals of the most used ones like git and bash (I can get out of the most gnarly git rebase or merge).<p>Knowing the <i>internals</i> of e.g. `bash` is too far for me. I&#x27;m happy if I even knowing the surface of it! I guess they mean that cargo culting these tools usually doesn&#x27;t lead you anywhere good and that invesing the time into them will pay off, as opposed to &quot;cookbooking&quot; it, like with git in that xkcd.<p>&gt; 9. Only learn from the best. So when I was learning Go, I read the standard library.<p>I think this is important, but it is very difficult for programmers to do this,<p>&gt; 10. If it looks ugly, it is most likely a terrible mistake.<p>I don&#x27;t think this is good advice because it suggests that all code should &quot;look nice&quot; and if it doesn&#x27;t it&#x27;s just wrong. In my experience the number one metric (if you can even call it that) one should be concerned about is flexibility. If your code is &quot;rigid&quot; and difficult to change it really doesn&#x27;t matter a whole lot how nice it looks, because, presumably, you&#x27;re not really sure exactly what you&#x27;re doing, and the code you write will probably not last very long in the codebase. It&#x27;s hard to put a number on this, but I&#x27;m pretty sure most of the code I write does not last a month. All the time I&#x27;d spend worrying about whether this code was &quot;ugly&quot; is effectively wasted, because in a month it will not exist any more. Make code easy to replace.<p>&gt; 11. If you have to write a comment that isn&#x27;t a docstring, it should probably be refactored.<p>I also don&#x27;t agree with this. I think it&#x27;s completely reasonable to have comments in function bodies expalining what this part of the function does. See Jon Blow&#x27;s related blog post[0]. Docstrings are for users of a function, but you might also want comments for the people reading the function body. Sometimes this can be avoided by writing Good Code, sometimes not.<p>&gt; 12. If you don&#x27;t understand how your program runs in production, you don&#x27;t understand the program itself.<p>Very true; I&#x27;d phrase it as &quot;understanding the problem&quot;, in Mike Acton lingo [1]. If you don&#x27;t understand The Problem, then you don&#x27;t understand what your program, which is (a part of) the solution to The Problem, does either.<p>&gt; 14, 15, 16<p>This is good advice, and I imagine it&#x27;s difficult for beginners (or novices) to make sense of what to do here; some circles advocate for always pulling in dependencies, others for always inlining 3rd party trees in your own codebase. I actually think this is one of the parts of programming as a field that has the potential for some kind of a paradigm shift. I&#x27;m not convinced that in 25 years we&#x27;ll be still trying to write generic &quot;libraries&quot; for others to use, and other people will download semvers of libraries to ensure compatibility. There has to be a better way.<p>&gt; 17. Know when to break the rules. For rules like &quot;don&#x27;t repeat yourself,&quot;<p>Thank you! DRY is probably the worst of the n-letter programming mantras. DO repeat yourself! Do whatever you need to quickly get a better understanding of your problem!<p>&gt; 18. Organizing your code into modules, packages, and functions is important. Knowing where API boundaries will materialize is an art.<p>This is also very true. Given an API, filling in the function bodies is often close to trivial, and coming up with the API in the first place is indeed an art.<p>[0]: <a href="http:&#x2F;&#x2F;number-none.com&#x2F;blow&#x2F;blog&#x2F;programming&#x2F;2014&#x2F;09&#x2F;26&#x2F;carmack-on-inlined-code.html" rel="nofollow">http:&#x2F;&#x2F;number-none.com&#x2F;blow&#x2F;blog&#x2F;programming&#x2F;2014&#x2F;09&#x2F;26&#x2F;carm...</a><p>[1]: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=rX0ItVEVjHc" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=rX0ItVEVjHc</a>