Re:Local Variables
by imAsking9836 on Monday March 25, 2019 @07:18AM
(#19481563)
Been following this book for a bit but I can't quite find a good way to learn from it. Should I first read each chapter and create my own language? implement his language using language other than Java? Type by hand his source code following along and trying to comprehend the details?
[ Parent
| on HN ]
Re:Local Variables
by _hardwaregeek on Monday March 25, 2019 @09:22AM
(#19482204)
Typing by hand is an underrated option. Inevitably there's gonna be transcription errors, so you'll have to correct them and in the process understand the code. Also, just take a moment at the end of a chapter to review the code and make sure it follows. I thought that it wasn't doing much either until I realized I actually understood what was going on!
After that, you could maybe port it to a different language. But doing that the first time around would be a little hard. Especially if you wanted to keep the code idiomatic to the language.
> Type by hand his source code following along and trying to comprehend the details?
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.
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.
I unconsciously change variable names when typing code samples which later forces me to track data flow and dependencies