How do you read programming books and textbooks?

I always struggle when reading books related to programming and the software engineering field as a whole. I feel like it doesn’t feel right to read them passively so I tend not to read them until I’m in front of my computer, for some I think this is justified since they might contain code implementations you might want to try out, but because when on my computer I get occupied with stuff like assignments, tasks, work I rarely get the time to actually read them. I need some advice on how I should approach this, for both short-length books and larger programming textbooks. For textbooks, do you read them based on topics you need at the moment or cover to cover?

I have the same problem. Front-to-back I have read only a single book, and then only to find out whether I should recommend it to others. I keep wishing to read books but never get around to it. The closest I come is reading e.g. the entire Rust Book and much of Julia’s docs.

Some ideas:

  • Do read them while away from the computer. When you are inspired to experiment, write down the idea. Later on when at the computer, optionally do the experiments.
  • Sabotage your internet connection. Variants:
    • Read while traveling
    • Procure a machine suitable for programming language learning but cumbersome to surf the web on.
  • Start a reading club. (Do notify me.)
1 Like

I have the same issue too. For me learning to program is a hobby activity and not necessary to my vocation/job which is not in the tech field. I love my family, and I love my vocation so these two get the majority of my time and attention. Hobbies like discovering new things in Linux and Open Source, playing with the computers/servers in my home lab, and getting outside to hike, bicycle, and camping have to take a back seat to my family and my vocation.

So I often start reading a programming book and lay it aside for a few weeks. When learning to programming isn’t a high priority it is probably best to look at other low priority items that you spend time on, eliminate those and fill it with time in a programming book.

I think for me, I need to eliminate my leisure watching of camping YouTube videos, and some of the shows I watch on TV and fill this time with working through a programming book instead, because I would be able to use programming to automate and enhance some of the things that I do at my job or in my home lab every day.

Also, if you can set a specific time each day even it is only 20-30 minutes when you can schedule time with your programming book this might help you get through it. You could connect a daily habit with reading through and practicing concepts in a programming book. Let’s say you always spend time reading news articles with your morning coffee for about 20 minutes, replace reading news articles with reading and applying your programming book instead.

I really liked the idea that @MatthijsBlom gave of “sabotage your internet connection” by setting up a computer to learn programming but you can not surf the web on it. My son who programs in 6 different languages started this way. He learned C++ on a 1st generation Raspberry PI which seemed fast when using the terminal, but was painful to open a webpage on it. From that experience he fell in love with the Linux CLI, bash, and vim to the point that he likes to interact with our home lab servers over ssh and through the CLI.

1 Like

This is exactly how I try to read programming books. Trying things out as I’m reading them is how I learn best. Not only because the book might have code samples you want to try out, but also because the book doesn’t have all the code samples I want to try. While reading a book, I try to approach it with critical thinking, and usually when learning something I go “ok, if I can do this, does it mean I can also do <insert_usually_stupid_idea_here>?”. And then I have to try it out!

Another trick I usually use to force me to practice while reading a book is to think of a project beforehand I want to build using that particular technology. Then as I read the book I go “oh, this sounds useful for the project, let me try to implement this bit of the project using this”. These projects are usually small, and are not always built from scratch, I might want to try to apply the knowledge to an existing project. But the main thing is to try to have a project in mind. That’s not always possible. I don’t always have great ideas for projects where I will apply the knowledge of the book. This is also where this site called Exercism (you might have heard of it) comes in nicely. As I read the book, I try to check out Exercism exercises to force me to practice. Even if I have a project, I try to check out Exercism anyway.

This was not easy for me at first. I don’t like reading long pieces of text on screens, and the sources of distraction are definitively a thing. Because of that, if I can, I try to read physical books. I tried reading physical programming books with the computer on the side for some time. But physical books started taking up a lot of space, becoming unsustainable. This was not working very well for me, as sometimes I want to copy/paste something. And distractions are still a thing.

Eventually, I bought an e-reader, which takes little space and can have tons of books. While it’s technically a screen, it doesn’t feel like one to me, so I like it. It’s close enough to paper to me, and I use it a lot for non-programming books and textbooks. The e-reader is still not ideal for programming books, as you still have the problem of wanting to copy/paste the code samples sometimes.

Eventually, I gave up this fight and just started reading programming books on the computer and tried to get used to it. It helped that I found a great reader in calibre. I use calibre to manage my book collection, but it also has a highly customizable reader. The main customizations I made to the reader were to put the page’s background not white but rather a more pleasant color to the eyes and control the amount of info shown on each page. As for distractions, what helped me was setting up time for learning and respecting it. If I’m going to reserve space for learning, I’m going to learn and not do anything else in that time. Since I’m using the computer to read the book, I turn off anything else that is not related to the book or what I’m learning.

It depends. I try to read them based on the topics I need at the moment, but sometimes all the things in the book interest me and I end up reading it cover to cover.

But there are others where I feel I get what I want from the first chapters. In that case, I stop reading them when they stop being useful.

1 Like

If I’m new to a language I may start to read a book on it as an introduction. I usually don’t finish the book, though. At some point I start using the language and will then either look things up online or go to a book for explanations on specific topics.

Books that aren’t on a specific language, but are on more general things like design patterns or refactoring, I’ll start to read cover-to-cover, but I usually don’t have the stamina or patience to make it all the way through, and then I may jump around on topics that interest me from the table of contents.

When I look back to over 25 years of reading programming books, I can’t recall ever reading one all the way through, unless you count The Soul of a New Machine by Tracy Kidder, but that was more about hardware than software.

1 Like

I have to play with my text like some kids play with their food. While others prefer paper books I always get digital versions because I can engage with them in different ways, using text-to–speech in particular.

If you’ve ever tried TTS on text that includes code and/or maths formulas, you’ve likely been struck with a combination of amusement and dismay as it chokes on it and recites a bunch of gibberish. To me this offers a fun opportunity to actively engage with it, by editing the text to prepare it for speech. I’ll rewrite the problematic sections by describing what it is doing in a way that makes sense in English.

For example:

for (i = 0; i < 100; i++) {
    for (j = i; j < 10; j++) {
        some_function(i, j);


“We have here a nested for loop which increments a counter variable i from 0 to 100, and the inside loop increments variable j from i through 10, calling some_function on i and j.”

When I finish a whole chapter, I reward myself by sitting back and having it read it to me.

When I was stuck in bed with COVID, I did this with some large sections of Knuth :sweat_smile:

1 Like

I almost always read programming books on the computer.
My current ebook reader of choice is Foliate, but often I prefer the PDF version to the EPUB version for programming books. The PDF version tends to have nicer formatting and I don’t want to mess around with CSS.

I often read the chapters in a technical book in two passes. In the first pass I just take in the information, not looking up too many words or concepts that I might not immediately understand, trusting that the author might explain them later. I try to get the broad concepts.
On the second pass I try to look stuff up that I still don’t understand. I’ll do the exercises or type in the example code to follow along.
Reading everything two times might seem like a huge time investment, but not doing it feels actually more draining to me as I’m constantly switching between two modes in my mind.


Thank you all for the responses, I’m definitely gonna try out some of the ideas mentioned to see how it affects my learning.