views:

255

answers:

10

While reading a new programming book, which of the following you are doing?

  1. Download the examples and check them while reading
  2. Try the examples by hand one by one while reading
  3. Finish all the book with just reading the examples, then try them all after that
  4. Try examples of each chapter at its end
  5. Other (please list)
+5  A: 

I try most of the examples as I'm reading the code. Nothing helps learning like doing it yourself and plus that gives me the chance to correct errors in my understanding on the spot. I can also experiment with the code while it's still fresh in my mind.

jasonh
A: 

I do one example at a time, but I try to fully understand the text (and the code) first.

Often, the examples in a textbook do not wrap all of the intricacies, so I will contrive my own example.

Robert Harvey
+2  A: 

I have never tried the sample code in a book (not that I can recall). If the point isn't construed clearly in the text or through psuedocode or even through simply reading the code, then the book probably isn't worth reading.

so i understand that you just read the examples well and never try them your self, i understood you right?
Amr ElGarhy
I'd agree with this. Either an example conveys the idea without entering it adn trying it out or its more or less useless.In books code is/or should be for reading.
mikej
+1  A: 

I'll read over the code and make sure I understand what it's trying to accomplish, but from there it exists mostly as reference for me.

scottmarlowe
+2  A: 

I typically don't try to do all the examples. When I come across one I don't understand immediately or find interesting, only then I'll try running the code. I find it saves time and doesn't decrease my understanding of what I've read in the book.

mezoid
A: 

Try any examples that look interesting as soon as I see them. Skip boring or obvious examples.

Norman Ramsey
A: 

I don't try any examples until after I have skimmed through the text a few times and read certain sections with a lot of concentration. Then, it is time to try the code.

Sinan Ünür
A: 

Typically I only skim over programming books. First I go through the contents, maybe the introduction to the language. From then on I normally use references and only return to the book if I need advice/background on some specific language construct. Most learning is done by reading code from others, searching for specific solutions on the web and understanding these parts

Examples, in this process, are often used as templates for a solution to a problem I am currently working on.

I admit that I probably miss some specific features of the language, because I only get to know them if they are used in some example code I find by searching for a solution. But, normally I get by with using language constructs that are more or less similar to other languages.

I deeply am convinced that the only way of learning to express yourself in any language is to use that language. This is both true for programming languages and natural (human) languages. Mistakes happen on the way but are caught by compilers, test-routines, or fellow humans. As with walking through cities, a detour always increases your knowledge.

I own some programming books, but I admit to use them only seldom. (I actually brought a C-reference-book from home today. Programming books tend to always be at the wrong place when you need them.)

Don Johe
+5  A: 

Mostly I agree with roygbiv: I read examples to get a concrete expression of what the writer is saying, but I see little point in trying to run them myself. If they don't work, the effort is pointless, and if they do work, that should just reiterate what was in the book.

What I DO do when I want to make sure I have learned something is try to write some example program of my own that uses the principles from the book, only looking back to fix one problem at a time. For example, when I was first learning Windows GUI programming, I reached the point where I said, Okay, put away the book and all notes and everything, take a blank screen, and try to write a simple but working Windows GUI program. Of course my first try blew up with smoke billowing out the back of the computer, or so it seemed. Then I looked back at the book to try to figure out what I'd done wrong. I fixed one thing and tried again. Still not working. Back to the book for more help. And so on back and forth, making sure I fully understood every mistake from my first try, why it was wrong, and how to do it right. I think it took me all day to get a simple "Hello, world" program running, but by the time I did, I understood everything that was in it and why it was there.

Jay
+1  A: 

I don't like trying the examples. I prefer to use the new stuff I am reading in my own personal projects(s). I find this hands on approach and brains-on approach (left and right both on) really cements the information in my body-mind. It makes it mine. Just going through the examples doesn't make it feel like it is mine, but something borrowed. It works for me, but I don't know if it is something that works for everyone.

Alex Baranosky