This is an interesting idea for better learning a new programming language or technique, borrowed from Benjamin Franklin:
About this time I met with an odd volume of the Spectator. It was the third. I had never before seen any of them. I bought it, read it over and over, and was much delighted with it. I thought the writing excellent, and wished, if possible, to imitate it. With this view I took some of the papers, and, making short hints of the sentiment in each sentence, laid them by a few days, and then, without looking at the book, try’d to compleat the papers again, by expressing each hinted sentiment at length, and as fully as it had been expressed before, in any suitable words that should come to hand. Then I compared my Spectator with the original, discovered some of my faults, and corrected them.
Franklin would try to copy the writing he admired from memory, and corrected what he’d done poorly. James Koppel suggests applying the same concept to learning from programming books:
Read your programming book as normal. When you get to a code sample, read it over
Then close the book.
Then try to type it up.
Simple, right? But try it and watch as you’re forced to learn some of the structure of the code.
It’s a lot like the way you may have already been doing it, just with more learning.
I’m going to give this a try with my next technical book.