Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How many of you actually work out the exercises when learning from a book (any programming related book), I'm currently working my way through a C++ book and find that some of the exercises I feel I can complete rather easily I skip. Do most people do this? Or do they read the whole book and come back to exercises that looked difficult?

share|improve this question

migrated from Apr 13 '11 at 15:24

This question came from our site for professional and enthusiast programmers.

closed as not constructive by Eric Wilson, Mark Trapp, Walter, Jonathan Khoo, NickC Apr 14 '11 at 0:29

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

related post… – igor milla Apr 13 '11 at 15:22
I enjoy riding a stationary bike while reading, made it easy to get some physical exercise and study during undergraduate. Though I suspect physical exercise is not in context here. – Chris Apr 13 '11 at 15:32
Sorry, like some others, I was the few who never did any excercises on the textbooks, I looked at the answers at the back and tried to understand what they said and why was the answers so. – Buhake Sindi Apr 13 '11 at 20:20
No one else finds it hilarious that this was migrated from StackOverflow and then promptly closed on Programmers.SE? This is Soviet-magnitude bureaucracy! XD – Andrew Heath Apr 18 '11 at 3:40

14 Answers 14

up vote 17 down vote accepted

I find it to be helpful to actually type in the solutions to the exercises and run them. Sometimes you'll get the answer on the first try, and sometimes it's a little bit trickier than it first looked. You'll never know what you're missing until you have working code.

One huge benefit to typing in the exercises yourself if that you get practice debugging. If it's a new language and a new environment, you'll inevitably make mistakes. Getting the solutions to even the simplest problems to work is good practice.

share|improve this answer

I find that I tend to skip trivial exercises unless I'm still at the stage where I'm having some difficulty even wrapping my head around the syntax of a new language. They are there to give you something to practice as much as to provide a thought-provoking challenge.

share|improve this answer

Its quite hard to learn a language from a book, computer language or human, without practices you will never master it.

I usually find that doing the excises and typing in the examples gives you much more context, and understanding, even the ones that looks easy, might teach you something about how the compiler works, and other things that one needs to know to actually use the language.

On the other hand I almost never manage to finish a book about a new language, as it takes ages to go through all exercises, but I would at least try to do an excise in each topic.

Another great aid is as "thorsten müller" suggests, to have some project to start to implement, fx. a B-tree sorting or something is always fun to implement :).

share|improve this answer

It depends on the book. The puzzles in K&R for example are quite epic and instructive, and there's even a book, called The C Answer Book that covers the exercises in the detail they deserve.

If you're reading Knuth, you really aren't getting anything out of it unless you read along with a pencil and paper. Of course, some of the Knuth problems are well known open problems, so you won't expect to get them all.

As an instructor, however, I've found that many exercises in many otherwise good books are just terrible. Some of them are just BS, seemingly tacked on at the last minute. As a result, when assigning problems in class, I have to make my own. So long as you focus on the right books and the right problems, you'll get a lot out of it. I recommend you do the ones in K&R, even if your goal is learning C++.

share|improve this answer
+1 For K&R, I read through it (at a very fast pace) and did most of the exercises and actually felt as if I learned something on each one. Other books seem like I was picking and choosing – Adam Apr 13 '11 at 18:20

Only those that look interesting and challenging. If I know the answer, there is not much use in typing it.

Most of the time when I read books about a new language or technology I have my own small projects that I try to implement. Starting with Conway's game of Life, followed by a Sudoku solver. This has the advantage, that I've already solved them in other languages and can compare the results.

Though at the moment I'm learning Racket and since I have some difficulties with some details of the syntax I'm doing far more exercises than usual to get used to it.

share|improve this answer

I do the most simple ones quickly in my head, if that simple exercises even exist. I also try to see if I have the idea of how to implement one of the exercises, but don't implement them most of the time. The reason to actually implement is to see if you really got things right, as the compiler will be way more pedantic than your mind will be, and it will know the language better as well. But this varies, as the reason for doing the exercises is to repeat the knowledge you have gotten from the latest chapter and to actually make sure you know the stuff.

If exercises don't exist, I make some up on my own. I also always at least try to use the stuff in the chapter (type the code into Vim, execute, change etc.).

I sometimes leave some exercises for later, or to the end of the reading session (if I happen to read multiple chapters).

The exercises are there to aid learning, and I use them when I need that aid.

share|improve this answer

Reading books is a waste of time, unless you understand and remember what's written. Exercises make sure that you do. Besides, sometimes doing exercises is a fun!

share|improve this answer

No. I only read the code in the book and I sometimes don't even do that. Don't think it is necessary. After all I don't read the book to learn how to write code. I read the book to learn concepts and get new ideas.

share|improve this answer

It depends on the book that I'm going through. Usually, though, if I'm encountering a feature which I haven't played with before, I'll type in and run the example.

share|improve this answer

I prefer to workout on these exercises. These questions make us to think and analyse more and also result of this exercise is an indication of how well we really understood. The better you understand the less effort you need to memorize later.

share|improve this answer

If I am learning a new language and I know that I am going to work a lot in it I will defietely do each annd every exercise. By doing this I "absorb" the language and my basic syntax becomes strong. Also this way you dont just learn to code but also to "think" in a particular language. The second time I revise it I may not need to do the exersise.

At the same time IMO it isnt the same for all languages. Fore example I did not have to practice SQL too hard to become proficient in itwhereas for C/C++, I have practiced it at least four times (including my college course) to become proficient in it.

share|improve this answer

Never. I do, however, try to write something with that solution drawing from the mass of past experiences (failures in other words) and try to solve it. This seems to really draw the new thing into my brain, as I relate it to existing context.

share|improve this answer

At least not on first reading of good books, because most of the time I can't wait to learn what is in the next chapter.

share|improve this answer


Some people have the discipline to actually go through books and do exercises, but I am not one of them and I suspect many are the same way.

I think the model of book-learning is an outdated one. I would try and find lectures/labs online and do those.

For example, I learned the basics of Python by doing the Google Code University course.

In the end, there is no substitute for real-world experience and all that matters is that you actually learn the material, not how you do it. My advice is do it the quickest/easiest way instead of punishing yourself.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.