I read a wonderful post, 3 Things I hate about “beginner” programming books, which I couldn’t agree more with. Basically he has these points:
- Too long
- Too many examples like “Hello World!”
- No answers to exercises.
Nr 1 is a pretty curious one. Even though I think a book is good, I often end up only completing 75-85% of it before going on with my own projects or with something else. Also the best books are often shorter than your average 700+ pages brick. Modern Perl, The Pragmatic Programmer and Effective C++ are all short but really good.
I always hate, really hate, when I can’t find an answer to an exercise in a book. Often I’m unsure or I frankly don’t know how to solve something, even after reading the text and examples, and I also think I learn best by copying. This may sound strange to you but I swear it’s true. When I made my first game I copied from a tutorial and after I changed and wrote something new. This is also the same when doing math, first I want too see examples and how to actually solve something then I copy that and then I go “hmm what does this do, what will happen here”.
The small constructed examples you always see, “this Vehicle is a class and the Firetruck inherits Vehicle”, are no use at all I’d say. Is that how you solve a problem? Is that how you program? Not really. Almost all examples are contrived and not useful at all, especially for beginners. I never thought classes where good before I copied a solution to some problem I had. Wonderful!
This is what I’d do if I would write a “beginner” programming book:
- I would use the whole book to construct a game. I would begin with simply drawing a shape, or an image, on the screen. Then I would make it move and at the end of the book I would have all the necessary code for a complete and functional game.
- I would provide all the code inside the book. Of course I could provide it online but the act of actually typing in something yourself is very valuable.
- It should be fun and easy-going. I wouldn’t focus on every little detail but instead on the big picture and my goal would be to get the reader hooked on programming.
That’s it! Learning programming is hard, but it’s also very satisfying. My summer project will be to teach my little brother to program, we’ll see how that’ll go.