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

I have a friend in prison who wants to learn programming.

He's got no access to a computer so I was wondering if people could recommend books that would be a good introduction to programming without requiring a computer.

Obviously he's going to need to keep learning once he gets out, and has access to a computer, but how should he get started now (he's got lots of free time to read obviously). Based on his goals I think Ruby or Javascript/HTML5 might be good paths for him to start down, but really for now it's most important to explain the ideas. Even if it's all pseudo code.

These need to be physical publications, paperbacks are preferred, and consider that he's got limited shelf space so large books could be a problem.


migration rejected from May 10 '15 at 12:21

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by Ixrec, Snowman, MichaelT, durron597, GlenH7 May 10 '15 at 12:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Ixrec, Snowman, Community, durron597, GlenH7
If this question can be reworded to fit the rules in the help center, please edit the question.

Can he have a programmable calculator? – user1249 Dec 19 '11 at 21:52

22 Answers 22

If your friend is interested in programming, suggest him to work on algorithms first!

Get some Topcoder puzzles, algorithm tutorials and coding contest problems printed out for him.

Give him an engrossing puzzle, I bet he'll forget to eat!

I would strongly recommend against giving him HTML5 books as that would frustrate him for not having access to a computer. Do not encourage him to learn front-end technologies.

+1 for staying away from front end technology. – yati sagade Nov 14 '11 at 3:59
Yep, puzzles are a great way to engage the analytic mind. As long as he doesn't have a computer, the best thing for him to do is cultivate his analytic abilities. – Stephen Gross Nov 18 '11 at 17:09
+1 for saying about Top Coder ;) ;) and you have even left this site – Ant's Nov 19 '11 at 1:07
+1000! "Do not encourage him to learn front-end technologies" – System Down Dec 19 '11 at 20:29
+1 algoritms and theory is easier to understand without a computer – user1249 Dec 19 '11 at 21:53

I spent most of my life as a mathematician and did not start writing software until after college. Learning to program in its simplest form is just a logical and procedural instruction or thought process.

That being said, books on mathematics paired with some language agnostic books, such as The Pragmatic Programmer, will be a great foundation for a fledgling programmer. Spending time on developing a mathematical foundation, in my opinion, is more important than mindless repetition. This will also help develop some level of abstraction, which is another important aspect in programming.

Programming languages themselves are just a tool and syntax is just syntax, the process itself is much more crucial for writing good solid code.

It's not necessary good at mathematics to learn programming. – Tien Do Nov 16 '11 at 1:09
While mathematics may not be necessary to learn programming, it really helps. For that matter, most everything that makes a good developer isn't necessary for programming; all you need is a programming language and something to execute code written in that language. Many of the basic ideas of programming (data structures, algorithms, functions, logic, algebra) are mathematics and it will make you a better programmer if you know those concepts. Besides, if we are talking about someone without a computer, math is the closest he will get. – Rahs Nov 18 '11 at 22:47

People were using lambda calculus before the advent of computers. Teach him the pure functional subset of LISP and set him problems like writing the factorial and Fibonacci functions before moving onto list manipulation functions.

It's possible to teach computer science without using computers as demonstrated here:


You could have him write programs and send them to you via letters which you then transcribe and run. Thus a language like Scheme would be useful since he can write out a mountain of Scheme code, have you test it and send him the results. It would be slow but it would work as a testbed.

As others have mentioned, mathematics is important and I'd recommend he take the time to become good at math. Obviously he won't be able to use the hottest or latest frameworks or anything like that but he should be able to learn to code just fine provided he has enough patience to wait for the results and you've enough interest in doing such a thing.

Kind of like the old "batch job" days in which you submitted your program to the computer operator and waited a day or two for the output! – Barry Brown Nov 14 '11 at 1:22
I really like this solution - a combination of puzzle solving and programs "submitted" to a machine. First, it gives your friend an excuse to correspond with you regularly, and prevents syntax errors from cropping up that he doesn't realize as he codes in his head. – Fomite Nov 14 '11 at 4:05

I'm going to recommend old school BASIC and a notebook. The nice thing about basic is that it can be "executed" by a person much easier than other languages. Tell him the trick of skipping lines while writing so he has space if he needs to add anything. If you want to be a really good friend then take his notebook home once a week and run what he wrote.

I haven't done BASIC in years and so I can't recommend a book, but I'm sure someone can. Just make sure you get a classic book without all the Visual stuff.

Why the downvote? – Pubby Nov 13 '11 at 23:51
It's such a pity computers don't (or really can't) come with manuals that teach you how to program them any more, like the home computers of the 80s did. The Sinclair ZX81 Basic Programming Manual was a classic... I spent months learning BASIC from that, much of it just from reading the book rather than actually typing in the examples. – scottishwildcat Nov 14 '11 at 2:16
Ah yes, I had a lot of fun copying programs from my Amstrads manual. Or learning how to make music with it or using it to draw lines; – Carra Nov 14 '11 at 8:17
If a computer is right out, you might be able to get your friend a TI calculator, the TI-83 and TI-84 each have the ability to write TI-BASIC programs. – dkuntz2 Nov 18 '11 at 7:04
I taught myself how to program from reading a copy of Dave Ahl's 101 BASIC Computer Games, long before I had access to a computer. The key (for me) was having both the source and some sample runs, so I could see how the program worked from both sides. I'm always disappointed when I read an article that gives sample code but then doesn't show you what the output should look like (especially when the text isn't clear). – TMN Nov 18 '11 at 18:46

Some ideas:

Read Code: The Hidden Language of Computer Hardware and Software. Its 400 pages walk the reader from binary codes, through logic gates, and up to assembly and ALGOL-like languages.

Would they allow a programmable calculator like the TI-83+? Or an old PalmOS device? It could be loaded with a FORTH, Lisp, BASIC, or Lua interpreter.

The Great Logo Adventure is written for kids, but Logo is so dirt-simple to learn that the book is really readable.

For older kids (high school, college), try Computer Science Logo Style. There are three volumes altogether.

Actually, the first machine that I learned to program was a TI-85 (I later upgraded to a TI-86). Its programming functionality is extremely rudimentary. It allows you to create loops, but not functions! It does allow for very primitive graphics, though. Do not underestimate it, though; it contains a 6 MHz microprocessor, which will allow your friend to accomplish quite a bit if he can get his hands on one. – Rice Flour Cookies Nov 18 '11 at 16:46

The biggest problem someone completely new to programming will face in trying to learn how to program without a computer is the lack of positive reinforcement to hold their interest and draw them into the field.

A non-programmer hasn't experienced the joy of seeing their self-authored code do something novel that they have complete control over. They won't experience the joy of seeing a program they've worked long and hard on come to life the first time it runs. They won't be able to experiment and tinker with their program and see the changes immediately in their program output.

An experienced programmer may be able to run through code in their head and appreciate the elegant design of a piece of code without ever having executed it on a computer, but I think someone completely new to the field would have a really hard time doing this. They may not even be able to get into the programming mindset or understanding the abstract concepts without seeing a sample program in action.

So the biggest obstacle for your friend would be sticking with programming long enough to pick up the fundamentals and actually get to the point where programming becomes really fun and exciting (and even addicting) because of all the possibilities it opens up. At least with a computer, there's the excitement of seeing newly discovered commands in action for the first time.

I would highly recommend he try to transfer to a prison where they do have a computer lab, or at least see if he can get a programmable graphing calculator. You can actually do quite a bit of programming on many of them, and they also have clear models that might conform to the regulations of certain prisons.


If he can genuinely say that his interest in learning this is part of rehabilitating himself to become a better and productive member of society, then my question is why doesn't he have a computer? To learn programming, he doesn't need an expensive computer, or even an Internet connection.

Some possible reasons spring to mind:

  1. He has not asked the prison authorities to help him with this
  2. He is incarcerated in a tyrannical dictatorship
My country prison prohibit almost anything, except books :( I won't say my country is tyrannical, but yes, the prison system is bit backward – Martheen Nov 14 '11 at 3:11
computers are expensive, computers have all kinds of parts you can use to make weapons out of, and/or hide contraband in. All reasons not to give them to inmates. – jwenting Nov 14 '11 at 13:37
Obviously we all want this guy to get a computer, but can you imagine the outcry if the prison system provided laptops for all the inmates?? People in America would loose their freakin' minds. They already complain a ton about "cushy" prison, with "air conditioning, free food and cable TV". I've got a good buddy who is a corrections officer, and based on his stories, prison is the LAST place I want to be. – Graham Nov 14 '11 at 20:28
@Graham yes, you don't want to be there but the fact remains that many prisons provide living conditions for inmates that are far better than anything they'd get outside (or indeed most people get outside). If it weren't for the locked doors and danger from your fellow inmates, it'd be a luxury hotel in many cases. – jwenting Nov 15 '11 at 6:41
@jwenting "it'd be a luxury hotel in many cases." Is prison food is 5 Star quality? Are prison beds covered in Egyptian cotton? Do you have a nice veranda to look out from in your cell? NO. So please do not say that they are "luxury hotels" if not for the other inmates. Furthermore, you CANT escape the dangers of the other inmates, so why do you even bring that up as an option? That's like saying jumping into fire would be fun if it weren't for that darn heat. Prisons suck at best and are very dangerous at worst, even in 1st world countries. – Graham Nov 17 '11 at 17:46

well i am absolutely certain that i would be a better programmer if, more often, i would excercise the discipline to shut off my Mac and get a pencil and paper instead.

Another fan of the pencil-and-paper approach to learning computer science, the great Edsger Dijkstra, whom i don't believe ever served time in prison. This well-known preference of his was not of course an exclusive preference, rather he just believed that problem solving should begin with more basic tools of cognition before moving to the computer, to wit:

Computer science is no more about computers than astronomy is about telescopes.

Given the era in which he lived and worked (early 1950's until his death in 2002), clearly he didn't have ad libitum access to a computer for at least the first couple of decades of his professional career. Yet from the early 1990's until his death, he had a desktop Mac in his office at the University of Texas, though apparently he used it only to surf the web and check his email--for hard core hacking, Prof. Dijkstra continued to use a fountain pen.

Keep in mind that this conviction wasn't that of an academic mathematician, rather Dijkstra was in fact a programmer. That's certainly how he saw himself--e.g., his acceptance speech for the 1972 Turing Award was titled, The Humble Programmer, likewise, his first job came with the title "programmer", which apparently made him the first one ever in the Netherlands. When he listed this title on his marriage license application five years later, the authorities rejected his application because of that--no such profession, according to the Dutch authorities.

wrote about half a chess program while sitting by the poolside with pencil and notebook years and years ago. Still haven't written the other half (and long since lost what I did have). Taught me quite a bit about pointers and data structures. – jwenting Nov 14 '11 at 13:40
'poolside'--brilliant!. if you had compiled and run that code, i'll bet that you would have been pleasantly surprised at the quality. – doug Nov 14 '11 at 14:24

There is a reason it is called "Computer Programming".

For someone who wants to learn programming, a computer is not needed, but is an extremely important tool IMHO. That does not mean you cannot do it. To program you need to take a few different steps:

  • Computer Science: Have him learn some basic computer science. Nothing too in depth, just the very, very basics of what code does and how it works with the computer.
  • Teach him about the power of the Computer and the Code. Tell him about the potential, and have him realize the possibilities are endless.
  • Get down to business. Teach him a language with a simple syntax such as Python or Ruby. Have him code in a notebook, and have him indent, space, etc. while writing code.

Book Ideas:

Hope this helps! BTW, I would read all of the books!

UPDATE: Make sure he get's a jump start from a person, whether it's you or somebody else. It would only take 30 minutes to get started if your focused. Then he can progress by himself.


I started coding in Uganda in 1988. Back then the adults were using a terminal and time sharing off a server in Kenya! We had a server in our post office as huge as a 4 X 6 room and another in our central bank. I was not allowed to even THINK of them (13yr old trouble maker).

In 1992 an uncle from Canada sent over an IBM thinkpad and I downloaded Turbo C from AOL (isn't that what the internet was called?). Anyway cause my elder brother LOVE(D/S) games It became a timeshare type situation.

I learned to code by writing my code on a piece of paper and waiting patiently for 30mins (while my bro had a snack) to type in the code, save to floppy and press F5. If I was REALLY lucky, there was even time to not only place a break point, but to also troubleshoot the code till it worked. When I got to university, the student to pc ratio was 8:1 so while in the computer labs my ability to write decent code on paper really came in handy.

Coding on paper taught me one vital lesson. How to plan properly, visualise, psuedo code and implement. To this date, I still go 1 to 2 days without ever hitting F5 because I have reduced coding more to planning and typing.

The book I learned from was "C by Example" by an Indian (Asian) gentleman called Kalicharan.


I would say "The little Schemer" but Its not going to get you very far. How much math background does he have? IF he is reasonably happy with math he could try Structure and Interpretation of Computer programs.

Anything like HTML5 will be way to complex to understand without practicing it.

My vote is also for The Little Schemer as it teaches you how to think recursively. All one would need is a pen and a paper. This method has definitely worked for me. Please get him a copy of this book. He will definitely thank you later. – Nanda Nov 16 '11 at 4:16

syntax of language can only be appreciated on computer, thats why we programmers spend more time in debugging @ start....

Anyways,languages are just a tools of expressing the thought that we wish to work out, so without a computer leaning languages is totally waste of time

ask him to work on the basics, algorithms if he is to much interested in programming


There are a few solutions I think:

  1. Choose a programming language which is easy to learn on paper. Personally I learned most of what I know of Haskell by simply reading "Haskell - The Craft of Functional Programming" while lying in bed. There's absolutely no reason you need a computer when just starting out in programming. Learning algorithmics and writing small programs can be done perfectly with pen and paper. Start with a simple book on a programming language, and after that read books on algorithms.
  2. Learn formal thinking. In university one of our first courses was formally proving correct small procedural programs, all on paper. Though you will never actually use this, this formal way of thinking about programmers will help you become a better programmer.
  3. Read books on computer architecture. Without understanding how computers work you can never fully understand programming. This can be done by reading book after book, and it is not necessary to keep them all. You could for instance read the books by Tanenbaum.

Lastly, don't let your friend get discouraged by not having a computer. In my university it's called Computing Science instead of Computer Science for a good reason. You can most certainly learn (the basics of) programming without computer. Good luck to your friend!


While it's not a recent book, Code Complete by Steve McConnell would give him a good feel for the fundamentals, including both the nuts and bolts of coding and testing and a sense of the bigger picture of SDLC.

Add all of the classics, such as Mythical man Month, these are language agnostic should be required reading for all programmers. tehres lists on this site of top 10/100 books - get him to read them all. – mattnz Nov 13 '11 at 21:06
@mattnz Sure they're helpful for programmers, but they will not teach you to program. – Adam Lear Nov 14 '11 at 0:02

I learned to program in BASIC without a computer (initially) using this book: Basic Computer Games. It has listings of computer games to type in, along with one or more sample "runs" of each game. I followed each sample run along its execution path, and thereby worked out the fundamentals of how BASIC worked.

I would recommend not dwelling too long on BASIC though, since it only encourages bad habits that will need to be shaken off later. So the next thing to move onto would be something like this: How to Think Like a Computer Scientist: Learning with Python.


I think that the question itself is inaccurate, and most of the answers following. I loved the

Computer science is no more about computers than astronomy is about telescopes.

I think people don't realize that Computer Science predates computers, in fact, Computer Science (with a lot of closely related Math and Engineering, these three fields overlap a bit) created that's how technology works. Why is that revenant? Simply because your friend shouldn't be teaching himself "programming", he should be studying Computer Science. He he learned Computer Science first, and while he lacked a computer anyways, he would be much better served in the future, learning any language (they change often, and that has to do with how languages become cumbersome and bloated as they have to expand while maintaining they existing grammar and compatibility). And the nice thing about it is that it can be done without a computer and has been done, and will continue to be done without one.

I will list a few of the most important areas, Discrete Math, Computability, Logic, Algorithms, the Study of Programming Languages, and Systems. With these tools at your disposal designing and implementing well-written, efficient, and correct code becomes much easier. The only thing missing would be the specific syntax of a specific language, but with programming languages you will understand how programming languages work as a whole and filling in the specifics of a language is just a matter of learning how it does things. That is my advice, I hope it is received; Computer Science, not programming is the way to go (even if you do have access to a computer). And I can give specific book names, of ones I used I my studies if that is required.


He cant learn programming without a computer. Not fully anyway.

While reading a book on Algorithms and another on a concrete language such as LISP will help later on down the line when he has a PC, there really isn't any comparison to actually writing the code yourself, debugging it and seeing the output.

Possibly he could put in a request for a basic pc with no internet access or the use of a public PC.


Assuming acquiring an old, non-internet connected computer is out of the question: A little bit left field, but I'd recommend getting him a copy of The Diamond Age by Neal Stephenson. It might not be directly helpful for learning programming, but several of the puzzles in the book require "algorithmic thinking" to solve, and one of the characters is imprisoned in a castle and has to use Turing machines to escape. Thinking about about some of the problems in the book are as likely to be helpful for understanding how programs and algorithms work as anything else you could do without an actual computer.


He definitely can learn programming without a computer, but this period must be not too long. Learning programming totally does not mean you have to sit in front of a computer all the time, especially when he is just starting.

Before he can actually write code in a computer, it'd better to make himself to be familiar with several basic things such as how computer/compiler/Internet/web and browser works. He must also learn at least at basic level about popular algorithms, and object oriented concepts.

I did started myself learning programming about 15 years ago without any computer, it was too expensive and my parents simply couldn't afford it. I almost read and remembered by heart all content of my first programming book, it was a beginer's Pascal book.


There are (programming) books that are more readable and those that are not. What I remember from my childhood, and were finely readable offline. I would think that from the modern ones, Kent Beck's XP:Explained and TDD books could be as well.


he can't learn programming but he can surely work on the theoretical part though. try to give some architetural, design, principles and all that stuff that. When he comes out it will be a lot easier.


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