Wednesday, January 2, 2013

How I Read Programming Books

I studied Electrical Engineering in undergrad and the only programming languages we've had to use in EE were C/C++, Assembly, and Matlab. After going to a Startup Weekend event and getting interested in software dev and computer science I decided I wanted to get my hands dirty and jump in the field. I realized I would need to learn a different set of languages to hack together projects.

In the past year and half I've been learning Java (for Android), Python and JavaScript (& HTML/CSS) (for web development) and I've come to realize that the best way to learn programming from a book or tutorial is to read it 3 times! Yes, read it 3 times!! Reading new content this way has helped understand new languages/concepts well. I'm confident it can help you, a beginner to programming or a certain programming language, maximally absorb knowledge from whatever it is you're reading.

The First Read

My first read of a programming book is to just read for light understanding. In the first read I try to follow the author and where they are taking me with the examples. I also learn, not fully, the syntax and try to understand how the programs flow. I don't type any code in the first read. I think because I have previous programming experience I can usually follow any programming book. I don't expect myself to code in the language I'm learning or correctly apply the content I'm learning after the first read. I do however have a good sense of what's going on. (Btw, I usually read a chapter or section at a time, not the whole book).

The Second Read

In the second read is when I type out code. I usually type out each example in a section. The reason I read the sections first and then comeback to type out the code is that I understand where the section is going and I know what the code can/should do. I have a good understanding of what's going on, I'm not just typing code blindly, waiting to be told what it does in the following paragraphs, and then going back up again to re-read it. Typing code I understand helps me remember the syntax.

The Third Read

In my third read I try to do the examples without having to copy the code. I usually just go to the section or chapter exercises and try to solve them. By this stage I remember the syntax introduced in a  section/chapter pretty well and I can just solve the problems.


This is what has worked for me to learn Java, Python, and JavaScript. Another great way to learn programming languages or concepts is to do a personal project. So if you wanted to understand more about GUIs or graphics in Java, try to build a PvP Chess game, this will force you read on graphics, animations, gui's, event driven programming, etc.

The problem with solely doing a personal project  w/out reading a book on the language is you won't be applying the best practices for completing a project (in that language) but you'll just try to get the job done. You also won't know how to really code in that language, especially if you're coming from another programming language. What I mean is that you may be writing C style code in Java because you haven't learned the way of doing things in Java because you know C and you're just trying to pick up Java syntax to get the job done.

I recommend learning a new  language from a book for starters rather than following tutorials. You get a good narrative from a book. But when you're going through a book, don't confine your work to the exercises in the book, try to do your own projects. Also be sure type the code you're learning, don't think that reading and understanding code is enough!

I'm not an expert software developer (yet) but learning about programming/development this way has definitely helped me get around pretty well. Let me know what you think of my approach in the comments below :)


  1. I've been teaching myself C++ and openGL for about a year now and I've tried this approach as well; I agree it has its advantages.

    I will mention one pitfall that I've come to recognize. In terms of the first "light" read through of a book, I think it's important to develop the ability to recognize certain concepts and ideas that absolutely must not be glossed over or passed up without fully understanding them first. If you misunderstand a key topic and continue reading anyway you will likely waste a lot of time until your second pass through the material.

    In short I believe it's a balancing act between knowing which "walls" you must tackle before moving on, irrespective of how much time it may take, and the sometimes non-trivial details you can sort out when you understand the framework of the material better.

  2. I agree with you, it is a balancing act. I think slightly understanding what you're typing helps you understand the code more than just coding right off the bat.

    The more experienced you are with programming the better you'll be at light reading. At a certain point, you'll have learned enough abt programming concepts that the syntax of language is what holds you back. Thus multi-phase reading helps with memorization of syntax.

    Good luck w/your c++ & openGL work!

    1. Absolutely agree, and that is when programming really starts to become rewarding and fun in my opinion.

  3. Can you recommend a list of some of the books you've been using as first reads for your various 3x read technique per languages?

    1. I would like to know them too :)

    2. You can really read any book but here's my list of recent reads,

      For web stuff
      -Head First JavaScript by O'Reilly
      -Think Python by Allen Downey
      -the Django book
      -The Art & Science of CSS

      -Beginning Android Games - Mario Zechner
      -Thinking in Java - by Bruce Eckel

      I jumped around because after starting w/Android I started getting interested in web development. It's better to develop expertise to really be functional with a language/tools but my goal was to hack some projects together.

      Also try to learn Algorithms, they will really help you break out of the box when it comes to programming. There are plenty of good algorithms books, they are hard to read for first timers tho!

    3. A bit OT, but I just can't help but second the recommendation of Downey's Think Python.

      For years I had had some vauge idea that 'I wanna learn to program them thar computers.' Maybe once a year I'd pick up some 'Teach Yourself...' or 'Intro to...' book and promise myself I'd stick with it. I'd usually make it through a chapter. Sometimes two.

      Think Python is the book that finally helped me break through that wall, and it was largely because it was in such nice bite sized chunks that it lent itself to approaching the material the way you describe. It also probably helps that Python is just so awesome and accommodating (In retrospect it's no surprise I didn't make much progress through Learning Pearl before giving up...)

      Anyway, I was coming from a very different baseline than you are, but I can honestly say that book changed my life.

      Also, I'd love to hear your take on Head First JavaScript or the whole Head First style in general. Personally the approach bugs me, but you know what, it works.

  4. I think the key here though is that you are not just reading. You are actually doing (building muscle memory for programming) which is another form of learning. I've taught Python tutorials using a similar process: I present something. I give some examples. I give you a (self-checking) assignment that validates that you understand. People really appreciate this.

  5. Seems like a good technique, I've got to give it a shot. I think I will try doing 2 reads at first. What I run into sometimes is I get stuck trying to understand something and until I grasp all of the fundamental details I hesitate to move forward. Your approach seems more agile.

    1. It is more agile. But be cautious when you develop a good reading flow that you don't over read and get far ahead. If you read too far w/o coding the concepts can leave your mind (temp memory) and you'll be intimated or just start to feel lazy about doing doing the coding work you left back...

  6. Very cool. I love this idea.

    Totally agree with you about learning from a book the first time.

    I've been going through programming books, but entering *every* fact I learn into a flashcard system, like this:

    Your way sounds better, though, so there's probably a hybrid, like maybe one quick read-through, then 2nd time enter all the facts into flashcards, then 3rd time do a quick read-through and do the examples without looking.

    Thanks for posting this.

    1. I will check out your flashcards system. I think it maybe helpful for digesting tough programming books/concepts like those in Algorithms books, which require more than just reading + programming. Given that their always asked in interviews, anyone looking for SW eng job should try whatever works to conquer them. And more important than passing interviews, we should learn algo's so we can make better ones!

    2. Great article and idea Ahmed, and it's a great idea yours too Derek.

      Currently I'm keeping a wiki diary of everything I study.
      I find rewriting what I learn in my own words, in my way of thinking, helps me better understand it.
      In addition having to integrate and reorganize an argument page every time I learn something new about it force me to review everything I wrote down earlier.
      I am doing this for only a few months now but I'm finding it very helpful.

      Now I stumbled upon your ideas and I wonder how could it be possible to get out the best out of this three approaches. Any ideas?

      Thanks for sharing!

    3. That's awesome, is your wiki diary public?

    4. I preferred making my wiki private: I can insert copyrighted material if it helps making the argument clearer and I use it as a diary as well (I wrote down some thoughts from time to time.)

      In addition I'm keeping my wiki in my mother language (Italian.) My study books are in English and having to translate what I learn in Italian forces me to re-elaborate it further.
      Actually I wonder if this is not just an excuse because I still find it more natural to express myself in my mother tongue.

      After reading your article and the one from Derek, I installed Anki. This is the way I'm studying now:

      - I read a section a time (I stop when I feel it's time to re-elaborate)
      - The first time I read the section, I just try to understand the logic behind what I'm reading
      - The second time I read the section, I write down what I learned in my wiki and I codify the key concepts in flashcards inside Anki

      I am not trying this on a programming book, currently I'm studying "File System Forensic Analysis" by Brian Carrier. I think the third reading would be useful with a programming book.

      My feedback for now is: the study goes on quite slowly, but what I learn seems to be there to stay.

    5. Thanks for the article, Ahmed! This is basically the way I first learned Java, although I never elaborated it quite as well as you did. By the way, I completely agree that writing, instead of just reading, the code makes the syntax so much easier to remember.

      Thanks Derek and Domenico too for your comments because I also found documenting important concepts/tools to be really helpful, especially after taking time away from coding. The first time I learned Java I made lists of classes that I used regularly (and noted what they were used for) so I could refer back to them quickly.

      I'm working on C# now and considering expanding on the list idea to also include small examples of how the classes are used, especially the ones that aren't so well documented on the MSDN. I wonder if anyone has found this method useful and if they have any words of wisdom about this approach.

      Thanks again for sharing, guys!

  7. I prefer directly working on project rather than reading a book.

  8. Reminds me of Adler's "How to Read a Book" which sort of systematizes what you describe above as a way to get the most out of anything your read.

  9. This Study Hack using the Feynman Technique may be helpful:

  10. I agree to all but one point: Reading one or two books on programming any language doesn't give you the skillset for best practices. You need to dive into the community a little bit, read blogs and vendor documentation.

    If you try for example C, you will stumble upon many books containing bad style.

  11. "The problem with solely doing a personal project w/out reading a book on the language is you won't be applying the best practices for completing a project (in that language) but you'll just try to get the job done. You also won't know how to really code in that language, especially if you're coming from another programming language."

    Hear, hear!

    The fly in the ointment with your approach is the massive books on languages that come out today. Did you really do three passes through Eckel's 1100-page book that way. So, you read 3300 pages on Java and entered all the code? That sounds effective, but incredibly time-consuming.

  12. I was going to comment on the text, but on the 5th attempt to read your illegible captcha's thought I'd comment on that instead!

  13. I'm usually doing the exact opposite of what your recommending:
    I start with a problem for which the language to learn seems to be a good fit. Then I grab >5 books, a lot of code examples, tutorials and blog posts, and of course places like StackOverflow, and jump into coding right away.
    There may be very few examples where a single book can cover everything important about a given language. In my experience coding a lot and thinking hard about doing it right is inevitable for learning a programming language well.
    Cheers, Wolfgang

  14. Ahmed, you have figured out one of the best ways to learn a new topic using a "deep dive" system. I've been doing it for 30 years and it works great! Everybody has different learning sytles but I think your system is the best for self education (for most people). And yes we do live in an amazing world! Cheers and enjoy the creative zone!

  15. Another form, with the current modern technology (youtube world), there's everything out as video tutorial, in yutube. I am more of a "see and do" than "read and do" kind of guy. It works for me. But, i know, there's no substitute for a book, since that can be carried with you all the time, for re-reading !! Cheers, to all aspiring ones and curious minds !!

    1. Thanks! The "see and do" instills more confidence because you witness the event as if you did it, but books pack a lot punch in their own way.

  16. I do agree with the article and many of the comments that followed. I 'finally' decided to really take a look at web development and got a tutorial and (well) just started 'reading and doing' as mentioned by 'Ronnie'. I do have a personal project in mind; but I did want to take a look at 'best practices' -- become accustomed to the syntax -- and use the tools involved in the tutorial.

    Ah!! There will have to be re-reading and re-doing...

    I do agree there is not substitute for a book and some determination.

  17. Your words helped a lot.
    Great way to study and reMEMBER the syntax.
    Thank you!

  18. Sorry for the cased "MEMBER" on remember..

  19. Thank you for the new outlook on learning from a book. In the past, when I tried reading without coding the examples, I eventually had to go back and start coding the examples anyway. Keying the code directly from the book never seemed to help much. You couldn't quite grasp the concept because the syntax got in the way, and you couldn't quite remember the syntax because you were trying to understand the concept.

    The huge improvement I see in your method is the "one section at a time". I've always tried reading (and eventually coding at the same time) cover to cover, hoping the next section will help cement what is being covered in the current section.

    I can't wait to try your three-read method one section at a time. Three passes thru one section before moving on to the next may be the learning style I've been missing all these years.

    Thanks for the insight.

  20. We are a not-for-profit educational organization, founded by Mortimer Adler and we have recently made an exciting discovery--three years after writing the wonderfully expanded third edition of How to Read a Book, Mortimer Adler and Charles Van Doren made a series of thirteen 14-minute videos--lively discussing the art of reading. The videos were produced by Encyclopaedia Britannica. For reasons unknown, sometime after their original publication, these videos were lost.

    Three hours with Mortimer Adler and Charles Van Doren, lively discussing the art of reading, on one DVD. A must for libraries and classroom teaching the art of reading.

    I cannot exaggerate how instructive these programs are--we are so sure that you will agree, if you are not completely satisfied, we will refund your donation.

    Please go here to see a clip and learn more:

    ISBN: 978-1-61535-311-8

    Thank you,

    Max Weismann

  21. I suppose that the days are gone when I can pick up a programming language in just two weeks. However. I have always found that a hard-copy book is the best way to read for understanding. If you use post-it note bookmarks, you can quickly re-review key concepts as you progress through the book. I have never found this to be feasible with electronic media, especially when trying to bounce between several different key ideas (in several different locations of the book) at the same time.

  22. There are programmers and then there are developers. Programmers read books to learn languages. Programmers understand fundamentals and use Google as a reference. I am a programmer. I don't care if I have never heard of the language before, I will "know" it on the 'first read' - 'understand it' on the second read and excel at it by the third read.

    Programming a computer is amazing simple and languages are extremely transparent once you understand the fundamentals of programming.

    The sad thing is that nobody who writes books or sells programming tools is interested in teaching developers how to become programmers.

    1. Programmers read books to learn languages. should read "Developers read books to learn languages"

  23. You are talking about learning any programming
    language. And your suggestion is to read the book you
    have three times.

    I don't call myself an expert software developer.
    Although. I have been programming for more than thirty

    But let me tell you what my approach is. My approach
    is: don't read a book first. Start with logical

    Talking about a program. You have input and you have
    output. And you need a computer program to go from
    input to output.

    Think about the input that you have got and think about
    the output you want. Then figure out how to get the

    Once you knows how to get the output from the input,
    then take the book. And find how it is done. I think
    that is the way.

    Is the program perfect? Well. Start reading
    publications such as blog and newsletter. And learn how
    it can be better.

    Oh. I have written a blog and a newsletter. In it I
    talk about what I just have said. Here is where you can
    find my blog and newsletter.


  24. Do you want learn html programming easily?