Hacker News new | past | comments | ask | show | jobs | submit login

My girlfriend has told me a couple times she wants to learn to program but this is the only intro book I own. I feel bad giving it to her because it just beats you with recursion right from the beginning (that isn’t to say it’s bad, I love it, that’s why I own a copy. I just feel like you’ll appreciate it most if you already know a little of some non functional language.) On the other hand she took it with us on a picnic the other day and didn’t seem to mind, in fact the simplicity of scheme’s syntax actually seemed to help a lot (she tried python once and there were too many different syntactic structures, but that was me giving her a tutorial rather than going through a book so maybe I’m just a bad teacher.)

Does anyone have any suggestions?

I have high hopes for this Fall's MIT course in Computational Thinking [1]. While it was discussed here on HN, I don't think it got all the attention it deserves.

I think this course will end up to be the start of a revolution in online teaching. We've had MOOCs and OCW, and other courses online for a while now, but this is a whole different level. They enlisted 3Blue1Brown (Grant Sanderson) to lecture. Arguably, he is head and shoulders above everyone else when it comes to mathematical animations and intuitive explanations. Coupling the pedagogical genius of this guy with the research genius of Alan Edelman, and with the expressivity of the new language Julia (which might beat Scheme in the end), this is a recipe for absolute success.

Oh, and the main lectures are live and you can ask questions (and if your question is good, you receive the answer right away).

Run, do not walk, to enlist in this course.

[1] https://mitmath.github.io/18S191

I wonder if Grant feels lucky to get to work with MIT. MIT is obviously an amazing school but I really feel like they are the lucky ones. Even before covid, I thought that his work was light-years ahead of most math education. Now that everyone is scrambling to move online I'm sure he's even further ahead.

How to Design Programs (https://htdp.org/) is fantastic, I believe it's based off SICP but I found it a little more accessible. It leads into recursion pretty well and intuitively, probably the favorite programming book I've read.

If she is mathematically minded I would not be afraid of letting her learn with it (note that the corresponding course taught by the original authors is also available in video somewhere on the web and that you can use the SICP dialect with Racket).

Having discovered programming in a functional language (Ocaml) I found that it was people with prior experience in other languages (such as Python) who had the most trouble getting confortable with recurcion.

I’d recommend going through Brian Harvey’s video series while doing the book. Watch the video that covers the topic and then go through the section in the book. They also have recommended problems to do in the book. You don’t have to approach the book as a completionist who needs to complete every problem, etc. especially if you’re starting out. You can always revisit the book later with more experience, but the insights it can give you are invaluable . https://www.youtube.com/playlist?list=PLhMnuBfGeCDNgVzLPxF9o...

SICP was used as the reference book for the introductory course on programming on my degree. People with prior experience had the most trouble with recursion. Students with no programming experience whatsoever grasped the concept pretty easily.

I would try it out. It might need some analytically wired thought process, but again that is true for any kind of programming paradigm.

Let's not forget to draw a distinction between programming and computer science...

SICP was created to be an introductory computer science textbook back in the day when anybody who actually enrolled in a computer science course could reasonably be expected to be an absolute nerd. It's a book for teaching computer science to people who already have some amount of programming aptitude. It is not a book that tries to teach programming, to hand-hold students through learning practical applications. Yes, it's been shoehorned into many programming courses, but that's not the book's purpose.

HtDP is much better for teaching programming - it's a book that follows many of SICP's ideas, but doesn't presume any relevant experience on the part of the student. It's still not an ideal book for teaching practical programming to a student who doesn't care about any of the CS theory, though.

It depends on the person. How they like to think. I promise!

Whether we look at it as programming or computer science, it's abstract enough that it's highly personal and each person has their own idiosyncratic style of learning.

I did and would benefit much more from a book like SICP than books that are written into a more specific purpose.

Recursion seems to be one of those inflection points that some people just can't get past.

What I personally see in academic setting is that when recursion is taught, it's taught using examples where you would not want to use recursion.

It's easy to understand why recursion is useful when you are tasked with traversing a file system. It's not when the first example you are given is calculating Fibonacci sequence.

I like the way SICP handles this, actually. They state clearly (in the text, haven't watched the videos) that the naive recursive form for Fibonacci is only illustrative, then they proceed to provide the iterative form. Following that they have this paragraph:

> One should not conclude from this that tree-recursive processes are useless. When we consider processes that operate on hierarchically structured data rather than numbers, we will find that tree recursion is a natural and powerful tool. But even in numerical operations, tree-recursive processes can be useful in helping us to understand and design programs. For instance, although the first fib procedure is much less efficient than the second one, it is more straightforward, being little more than a translation into Lisp of the definition of the Fibonacci sequence. To formulate the iterative algorithm required noticing that the computation could be recast as an iteration with three state variables.

Hopefully a professor in a course would make similar statements (I know mine did, repeatedly). And, at least in my early programming courses, we quickly (within a week or two) went on to those other problems where recursion was a natural and useful solution. The professors [0] introduced problems where recursion was either necessary (using for/while loops would be a non-trivial transformation with no performance gain) or, like naive Fibonacci, natural expressions of the problem.

[0] I transferred universities, not all courses lined up so I got to see the second school's introduction to this topic even though I was past that point academically. I was an unpaid TA (technically I guess I was paying to be the TA).

This is like complaining that when piano teachers teach students how to hold their hands they teach it with scales where it doesn't really matter. The importance of hand position is obvious when you are tasked with playing chords in a real song.

The very first exercise should be as simple as possible. Explicitly because you're introducing a new concept and so want as little else in the way as you can arrange.

I disagree to an extent. Sure file system traversal is great motivating example (or any tree traversal example for that matter).

However, the Fibonacci sequence provides good end to end example of recursion, then tail recursion/dynamic programming.

A great way to let someone understand recursion is to let them learn how the principle of mathematical induction works. It gets rid of all the noise related to the programming language.

That's because in order to understand recursion you must first understand recursion.

I thought it was a dark art before I worked my way through a few chapters of the Little Lisper. Then the spell was broken

It's "introductory" for MIT students who have a background in engineering, math, or physics, not average people off the street.

Recursion is hard for students to grasp when taught in math contexts as well, so I don't think this is a matter of prior CS teaching biasing them one way.

Python for the Absolute Beginner was very easy. Each chapter introduced a new concept (Ex: strings, variables, lists, iteration, branching, dictionaries, functions, file I/O, classes...etc) with a little text game (Ex: hangman). The writing is laid back and interesting. Once I read this I was able to start writing my own code with a little help using StackOverflow and it's been terrific for my career. There is no mathematical or computer science jargon to weigh you down. That can always come later. At this point programming is hard enough, but this book shows you all the building blocks and gives you some practice assembling things together.

The Little Schemer by Friedman is a good choice.


When SICP was written the majority of the freshman who took that course had never touched a computer before they took that class.

This can be interpreted two ways:

1. It really is an introductory text and, as the book says, recursion is a simple, powerful, familiar idea.

2. Times have changed.

I’m partial to interpretation #1

It depends on 'why' she wants to learn programming. What does she like and wants to be able to do herself? Like shiny gui, or webpages or own robot controller?

I happen to think SICP is a pretty good start for the reason you mention, the simplicity of syntax, in my experience it only gets hairy in the end when you start implement OOP on top of it.

Another good easy to learn as a first language in my experience is Rebol because it allows you to do stuff you ( meaning a person who uses a computer) might want to do quickly (send emails, scrape websites)

Of course another benefit of SICP is that it is written by people who are probably better writers about languages than most of the programmers hired to write programming books and articles.

> it just beats you with recursion right from the beginning

I'm not disagreeing with you as I write this, more pontificating on teaching styles... we all know recursion can get tricky / be hard to understand in the context of a programming language, but sometimes it's all in the presentation... if we tell the student right up front "hey, this is how we do this, no big deal right?" then perhaps they don't put up their natural defenses and make it into a harder concept than it really is?

I'd also recommend "How to Design Programs", newest version is here: https://htdp.org/2020-8-1/Book/index.html. It's a much more accessible version of SICP.

I've heard good things about Code by Petzold although I haven't read it myself.


I've read it; it's a phenomenal book to understand more about how computers work on a hardware and conceptual level, but it doesn't really teach programming. Still strongly recommended.

I suggest you trust the authors to know best when it comes to teaching programming. Sounds like you're worried it will be too hard for her. It might be. Non-programmers have lots of romantic ideas about what they think programming is. But the only way to know whether someone possesses any talent in it is to try it. I tried to teach one of my ex-girlfriends to program but I could tell before long that she didn't have the gift so encouraged her to do other things.

Automate the boring stuff with Python maybe. It quickly gives you useful results. But of course it’ll only get your feet wet, it’s nowhere near as formal and thorough as SICP.

I'm sure she'll be fine. She sounds like she already is. She might exceed you. People can teach themselves right?

This book looks good but I don't think I should start reading it, because I get the feeling it's going to let me want to create my own "powerful programming language" and be led down that (long, probably dark) rabbit hole.

To understand recursion first understand recursion on a recursive data structure (list, tree). It is very natural and there are loads of interesting algorithms. General recursion is more difficult to understand algorithmically so leave it for later.

If videos are okay i would recommend the course on edx.org taught by Gregor Kiczales "How to code: Simple Data" and the successor about complex data. They are based on the book "How to design Programs" also from MIT IIRC.

<3 A Type of Programming: http://atypeofprogramming.com/ <3

HTDP is a more gentler introduction to programming.

Applications are open for YC Summer 2021

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact