Good programming books will give you the fundamental knowledge that is hard to get from video tutorials because they’re just too short for this and focus mainly on coding practice.
As I already mentioned in the article How to Learn Programming with Video Tutorials, the most useful programming books usually contain about 90% of theory and 10% of practice. Their main purpose is to help you deeply understand how and why you should write your code, not just acquire a new set of skills.
This will give you a real freedom in your decisions as a programmer, since when you know the inner constitution of things, you have the possibility to look at them from several different perspectives and to think out of the box when you need to apply them.
At least, with the comprehensive knowledge of the topic that you’ll have after reading the programming books, you will always make educated decisions.
This is something you definitely should aspire to if you want to be a professional software developer. This is what differs great programmers from those who can only follow blindly the examples they were given in short video or textual tutorials, or on websites like Stack Overflow.
How to read programming books
Here is the short answer: read the programming book as you’d read an enthralling novel, from the first page to the last one.
Even if it’s a book about the topic you’re already familiar with thanks to a video tutorial, don’t merely leaf through the chapters the titles of which look like something you know well.
First of all, since the book has enough space to explain complicated things, chances are you’ll discover many interesting details you don’t know yet.
Secondly, it’s always useful to refresh you knowledge if you haven’t had a lot of practice so far and it’s unlikely that this relatively new information has already gained its place in the “I Remember This Quite Well” section of your memory.
Also, don’t skip the boring chapters. You don’t know yet whether skipping them will affect your understanding of the subject or not.
Something that might seem dull and irrelevant at the moment, can be an important concept the rest of the book relies on. If you don’t read those chapters, you won’t be able to understand properly the chapters you’re most interested in.
What to do with the code examples in the book
Read carefully every code example you see in the book. They are placed there not only to make the book thicker, but also to serve as a bridge connecting theory and practice.
And since your main goal is to learn how to write code, it would be strange to disregard the parts of the book that actually show you how exactly to do this, even if sometimes it’s hard to understand the code examples on the first try and this might be annoying.
These code snippets translate programming concepts into tangible code which sometimes helps you understand what the book author is trying to explain even better than many paragraphs of eloquent descriptive text.
Read code examples until you understand them clearly. Then put the book aside, open your code editor and try to write this code on your own.
When you’re doing this, it’s great if you can simply write the same code that you’ve read in the book. But it would be awesome if during this process you tried other context for the task.
Say, if in the book it’s a program that displays the color of cars, write a program that shows the color of bikes.
It’s much easier than it sounds now. It will be the same in its logic, you’ll simply use different names in the code. For example, instead of the function named showCarColor you’ll be writing the function with the name showBikeColor.
Just compare the following two simple examples. Don’t worry about all of those curly braces and other programming things you might be not familiar with yet. Just read it as plain English.
// the function to show the color of the car function showCarColor(carColor) { return "The color of the car is " + carColor; }
// the function to show the color of the bike function showBikeColor(bikeColor) { return "The color of the bike is " + bikeColor; }
What do you see here? Yes, the word “car” is simply replaced with the word “bike” everywhere. That’s it.
This tiny distinction makes a big difference. It makes you stop mechanically copying the code from the book and start actually thinking about what you’re doing.
Moreover, it gives you that important little confidence in your abilities: you’re actually writing your own code! Yes, this process uses huge training wheels, but still, it will click in your mind and help you make the transition from learning programming to actually writing your own apps almost seamless.
The more you’ll use this approach, the more confident you’ll become. At some point you’ll feel that you want — and, wow, you can! — do more than just renaming functions and variables.
Now you can slightly change the logic of the code from the book, add some functionality to it. And you should definitely do this. This is the important moment when you start cautiously removing your training wheels.
Do all exercises
If the book has exercises after each chapter (and almost every great book has them), you should do all of them. They might take more time than reading the chapter these exercises are following, which might make you want to skip them. You should never do this, even if they don’t look very interesting.
One might say: “Hey, I don’t want to do these boring exercises! I’m not at school. I want to code some real project, not this nonsense. So for now the only thing I do need from this book is theoretical knowledge. I will practice later creating my own website or application when I finish reading the entire book.”
Here’s the problem. When you skip those exercises, the farther you read the book, the less you understand. Skipping exercises doesn’t work, there are no shortcuts without trade-offs.
Reading programming books without doing exercises is almost a waste of time, since the new knowledge won’t last long in your memory without being immediately “anchored” by practice.
The exercises from the book will consolidate and test your knowledge. Doing some of them, you’ll likely discover that you haven’t really understood some points explained in the chapter, so you need to read about them once again.
It’s important to find these gaps in your knowledge at the very beginning. If you don’t understand some important basic things now, it will inevitably reflect on the quality of the further learning process, and even on your ability to create real projects in the future.
Ultimately, programming is about writing code and solving problems, not about learning. Even when you’re hopefully working on the most exciting programming project on earth, the vast majority of tasks during this process will be pretty mundane and boring.
So, if you’re very reluctant to complete such tasks during your learning process, then it’s a signal that you have to work on this. Otherwise programming might turn out to be quite a frustrating journey for you.
It’s ok not to want to do those exercises, nobody actually gets excited about them. But it’s definitely bad to skip them.
Whether you like them or not — just do them. You’ll feel excited when this job is done. After all, this is when you really write code on your own, it’s real programming.
The only case when skipping exercises might look justified it’s when it’s like the 10th exercise after one of the book chapters (yup, some programming books authors are that cruel), it basically has no differences from those that you’ve already done before, and it would take an hour to complete.
In such a situation you do know how to write the code that needs to be written in that annoying gigantic 10th exercise, but you are just too tired of doing the same things again and again.
Forget about Google for a while
Refrain from googling answers when you’re doing exercises from books, unless you’ve already spent several fruitless hours on them and got completely desperate.
If the exercise looks really difficult, you can use Google to find some little hint heading you in the right direction. But in general you’re supposed to complete these tasks on your own.
The goal is to make sure that you understood the information you read in the book and can use it in your work, not to pass an imaginary exam at any price.