I tend to read a section carefully, then close the book and try to reproduce the example without looking at it again. Of course I'll allow myself to use online reference material, as I do in real-life programming. If I really get stuck I'll take a look at the book, but just enough to unstuck me. The goal is obviously not to reproduce the example line by line but to reproduce what it does with the same global structure.
I've found that it's easy to zone out if I'm just typing exactly what's on the page in front of me. Following along but in a different language can keep you more engaged and think more about what's going on.
Re:Local Variables
by imAsking9836 on Monday March 25, 2019 @09:31AM
(#19482252)
It also becomes a bit of a battle against the desire of copying/pasting the code (It's even more tempting since it's an e-book with the code already formatted), not to mention that some parts are tedious to type like enumerators with many string elements
That's a good point. I also have a problem with zoning out when reading technical books. I should give your technique a try.
Isn't that the only way to learn from any programming book ? At least that's what I have always done. I am curious as to what other way people learn.