HN Academy

The best online courses of Hacker News.

Hacker News Comments on
Design of Computer Programs

Udacity · 20 HN comments

HN Academy has aggregated all Hacker News stories and comments that mention Udacity's "Design of Computer Programs" .
Course Description

Learn how to model problems, and how to optimize performance by using some of the advanced features of Python.

HN Academy Rankings
  • Ranked #19 this month (dec/jan) · view
  • Ranked #28 all time · view
Provider Info
This course is offered on the Udacity platform.
HN Academy may receive a referral commission when you make purchases on sites after clicking through links on this page. Most courses are available for free with the option to purchase a completion certificate.
See also: all Reddit discussions that mention this course at

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this url.
Thanks for the recommendation! It looks quite good. Assuming you're referencing this:

I have been meaning to brush up on my interview skills, and I've found the lack of structure in LeetCode's Monthly problem sets to be quite frustrating. Every time I'd get stuck on a certain problem, I'd dive deep into the techniques behind the solution just to discard that knowledge the next day, as the selection of problems was seemingly random.

Norvig teaches a really cool, and challenging, class on Udacity called the "Design of Computer Programs"[0] in Python where you can learn his thought process on how to write reliable and beautiful software to solve interesting problems.


I quite enjoyed -- program design by Peter Norvig. (Disclaimer: I had a very small part in preparing it.)
+1 for this. It's quite python-specific, but I found it amazingly insightful.
I'd disagree with amateurish.

I agree that some of what they're advertising looks like 'intro to web bodging' and 'learn to mash tables without learning the maths', but there's also Norvig:

Granted, I haven't actually paid them any money.

Norvig and Thrun's Introduction to Artificial Intelligence class was pretty awful. I hope their offerings improved since the original class in 2011, but I'd be wary of paying money for any classes with their names attached to it. On the other hand, Widom's database class and Ng's ML class were excellent.
You should check out Norvig's design of computer programs course on Udacity ( where he uses these kinds of puzzle programs to teach programming design concepts. It is a hard but really rewarding course.
His Design of Computer programs course on Udacity is amazing.

The problem with this course is that it is quite boring if you're not interested in given subjects - e.g. Poker lectures make me sleepy.
He's not really trying to teach you poker or even how to write a poker program but rather how to solve problems by programming.
Solve problems in particular domains - i.e. you have to understand the domain, learn rules - and it is very boring if the domain is not interesting for you.
GP just means poker as an example it vehicle bores him. I agree - same with deck of card exercises.
Tried to go through the course a few years ago. In my case it was the regex bit. Trying to write the code is a massive chore with with very little payoff for going through it, and needing to go through the instructions several times in a row. Gave up on the course there.
Great course, learned a ton from it, but yeah lesson 3 where you had to build / follow him building a regex interpreter was definitely a beatdown for me. Everything else was pretty manageable, but still challenging.
Some people gave up on that section (week 5 of 10) and went on with the rest of the course. That seems to work out OK.

(I felt a little bad about these reactions because I'd helped with that code. In its defense, I've also been told by a couple of people that they gained a lot by working through it.)

At one point I a friend was mentioning the regex golf comic and how some insane person on the internet solved it. I mentioned my pains with the regex bit of the Design of Computer Programs course, and how Norvig had some Chtulhu like ability to write regexes that befuddle mortal minds. Lo and behold, it had been Norvig all along solving that. Python notebook available in the pytudes above.
I second this. It's interesting and informative to watch him break down programs and to see his code. Plus, you get treated to selections from his Hawaiian shirt collection.
I have three recommendations:

Think Python:

Polya's How to Solve It:

Udacity's Design of Computer Programs:

Thank you so much for posting these links. I started reading How to Solve It and am a few pages in, and am so happy to have found this book. This is the value that I find here at HN that keeps me coming back every day. The new tools and new technologies, and the interesting tech news are all very interesting, but none as valuable as the gems that people leave in comments for others to discover, thereby enriching their lives.
there's also Clean Coders:

these videos are quirky (!) for sure, but filled with some real gems and a depth of perspective that's rarely found in other online courses.

the link goes to a free video intended as an intro to the aspiring programmer.

I'm posting this only because I've seen several of these videos and think they've got something special.

It's from the guy who wrote Clean Code and Clean Coder which are gems themselves !
If people like this, also check out his course at Udacity -
> Please don't be like Udacity

Huh? Udacity has numerous free courses. They've never made a free course non-free. Any new paid course is developed with new material, and they're still churning out free courses.

Here's one of the gems from the early days of Udacity - Peter Norvig's Design of Computer Programs:

And here's one of the early machine learning courses:

Peter Norvig's "Design of Computer Programs"

An introduction to some semi-advanced programming concepts using an accessible language like Python, taught by a giant of CS.

Steve Huffman's "Web Development"

Basics of developing a web application, it uses Google App Engine as a base but the concepts taught are easily extensible to other platforms. Steve comes off as a likable and competent teacher.

My all star lineup would be:

The Analytics Edge -

Design of Computer Programs -

Justice -

If I had more time I would love to go through the bioinformatics specialization on Coursera. They have 2 books and an exercise site ( It looks like great fun.

+1 for The Analytics Edge.

Along the same lines but a more thorough treatment of linear regression and statistical inference is the excellent Data Analysis and Statistical Inference

Design of Computer Programs was decidedly the best course I ever took online. I was lucky enough to take it when it was first offered. Peter Norvig was very active in the course forum.
Peter Norvig is really an impressive teacher.

I have been doing his course "Design of computer programs" ( and it really push me from basic/novice developer to intermediary.

He succeed to explain you things in a natural way. He seems to always start by the basic assumption. Working and thinking around any problems/surprises he/you encounter. So, you have the impression to discover things more than learning them.

I didn't realize he taught any udacity courses, thanks for the link!
I frequently and Highly recommend "Design of computer programs" to everyone I can. As an intermediate developer before taking it, I still recommend it. He is an amazing teacher I have learned considerably just from the way he explains and approaches problems.

Plus taking a class for free from the director of research at google :)

Google Schmoogle - Peter Norvig is a powerhouse name and Google gains in prestige for having Peter Norvig, not the other way around.
'Newbie' covers many experience levels - from afraid to turn the computer on to moving beyond Excel pivot table macros. People need different degrees of handholding.

Not necessarily my favorite, Coursera's Programming for Everybody [1] moves forward very very slowly. Great for some people, drying paint for others. It is taught in Python.

A course I think is great is Coursera's Introduction to Systematic Program Design [2] based on Felleisen's How to Design Programs introductory text. It is possible to register for the last session, from a year ago, and complete the work on your own. It is taught in Racket.

Another course that takes a learn-by-making approach is Coursera's Creative Programming for Digital Media & Mobile Apps [3]. It is beginner friendly and really encourages "getting into it". It is taught in Processing, and in some ways I think Processing is the ideal language for an introductory course in Software Engineering - it is pared down like Racket's student languages, provides just a pinch of Java pain, facilitates the production of really interesting output, and the environment provides a fast edit-compile-run loop.

For a person who is more oriented toward scientific or mathematical problems, Coursera's R Programming [4] might by a good fit.

Among the various Python Courses, I would probably go with Udacity's Design of Computer Programs: Programming Principles [5] because it is taught by Peter Norvig.

All that said, a book may be better than an open-enrollment class for many people, and there's a lot more variation.






Thanks! Reminding myself of her feedback I think that pacing might be a significant issue which is something I hadn't considered too much (oddly).

She's someone that has lots of computer experience but the closest she's gotten to programming before is simple Excel functions (think SUM). I think she'll be much more excited by one where she's working on "real world" stuff so I'm leaving a bit towards Creative Programming for Digital Media & Mobile Apps and hope that it spurs her to learn even more.

> I believe in the real world, you are best represented by a body of work and/or the ability to demonstrate that you are capable of tackling the problems associated with the job in which you are considering.

This is such a good advice! I remember reading Norvig's spellchecker[0] and said to myself: "This code is so elegant and beautiful. I could never write something like this."

I learned more about NLP, learned some Scheme, worked through Norvig's Design of Computer Programs[1] and improved my Python a lot.

What have I learned? Firstly, people like Norvig have tons of experience and are incredible clever. Also they have worked in the same (or similar) domain for decades. Of course they know cool data structures and algorithms for NLP problems. Back then I didn't realize this and thought that I was dumb. Today, I'm less dumb and know that it takes time and experience. Build, learn, build, learn, ...



Experience is more about knowing a million little tricks than it is about actual domain knowledge. Norvig's spelling corrector is an application of inverting the problem.

Instead of attempting to correct a misspelling, he attempts to misspell a word, then stores the misspelled word along with the original word. Then, to correct a misspelling, you simply look it up in the hash table.

Incredibly powerful mathematical concept that inversion thing. And there's a million of them.

Other "tricks":

* shuffling a deck of cards in O(1) (or shuffling anything at all)

* sorting in O(N) (with a limited keyset, and guaranteed no repetitions it's easy. Think about it).

* knowing the url to MIT's bit twiddling manual [1]

* know how to "rewrite" english (or any language) text. Really impressive. Also, mostly useless. It's called Markov Chains.

* understand how and why "every language compiles first to LISP, then to machine code" is true. Thinking about this yields no end of clever programming tricks

* make sure to have spent a few months in each style of programming. Imperative (doesn't tend to be a problem). Functional (NEVER change the value of a variable, ever, for any reason). Dynamic (write a calculator using eval, and go from there. Exploit it).

* having the experience that any style of configuration eventually ends up being a turing complete programming language, and so you should just import and use an existing language

* having experienced the power of query languages. Instead of having a few reports, implement an interpreter that allows you to query them. Then amaze everyone by having every new report they ask for done in 10 minutes.

* knowing the power of automated source translation tools, and how easy these things are to write IF you can munster the discipline of never touching generated code

All of these things will have people tell you it's impossible. And when they see simple code that demonstrates things like this, it's cheating (e.g. O(N) sorting is not fully general. That doesn't make it slower than O(N), and it's still applicable to a lot of situations) ...


why isn't it Stanford's manual?
Heh. Whoops. I got the link from MIT Opencourseware originally.
> shuffling a deck of cards in O(1)

How? I'm aware of Knuth shuffle which is O(n) but I can't find anything about constant time shuffling.

You use the algebraic property that xy mod n will generate a shuffle of Zn if y and n are relatively prime (don't share any divisors). So if you then redefine "element a" to not refer to the index of the original array, but to ay mod n, and you've got your shuffle. You pick y randomly, and in order to make y and n relatively prime, you simply change n to be a prime number.

None of this requires you to actually go through the list. You'd have to modify this to support lists of non-prime lengths, but this is the basic idea :

  import random
  lst = [1,2,3,4,5]

  class newlist:
      def __init__(self, lst):
          self.lst = lst # assuming lst has a prime length.
          self.y = 0
          while self.y % len(lst) == 0:
              self.y = random.randint(1, 999999)

      def __getitem__(self, index):
          nidx = (index * self.y) % len(lst)
          return self.lst[nidx]
  # Start shuffling
  nl = newlist(lst)
  # End shuffling ... algorithm done.

  for i in range(len(lst)):
          print i, nl[i]
Norvig teaches a Design of Computer Programs course on Udacity, which helps you think about solving problems.

I'm not sure whether you are trying to learn to program in general or Python in particular, but you might try out something like ["Design of Computer Programs"]( from Udacity. It's very engaging, somewhat difficult but you'll learn a lot.

Another thing you might try is taking a book with examples in one language and try to implement them in Python. It's a little weird but it can be a great way to have a framework for a task but have to explore on your own.

"I worry that it could be a waste of time"

It's education. If you want to stay 20 years in this industry, you have to invest in your education. Don't worry, just do it. Solving the problems would make you a better problem solver.

"I feel that most prospective employers don't really care about that, though."

That's right. Most prospective employers don't care. Don't work for them. If you have to, read my last answer.

"In otherwords, is SICP worthy of a CV bullet point."

Yes, really good developers would appreciate the effort. Employers won't care but the senior developer taking your technical interview may appreciate it.

"I should be focusing on more practical projects before looking for a first job." Yes, you must do that. Nothing beats showing a perfectly operational website. And depending on the profile you are targeting it can be a Android game or Web game or scraper or anything. Don't worry your github profile yet. Once you start building stuff it will come alive.

You can also check out for some practical courses. They are taught by awesome people and are free. All these courses focus on a project to teach you basics of computer science. And you get real world skills.

1. Building a Search Engine - Introduction to Computer Science -

2. Building a HTML5 game - HTML5 Game Development -

3. Building a Blog - Web Development -

4. Building a Browser - Programming Languages -

5. Building blocks of any non - trivial software project - Design of Computer Programs - .

All the best learning CS, building things and contributing to the world.

Second the Udacity courses. A lot more meat than the normal beginner stuff. If you're feeling ambitious the Norvig course is good.

The programming languages (cs262) or web development (cs253) courses would probably be a better place to start.

The intro course is also worth taking a look at.
You can also take a free course online ( by Peter Norvig with Udacity ( in case you can't make it to hacker school.
HN Academy is an independent project and is not operated by Y Combinator, Coursera, edX, or any of the universities and other institutions providing courses.
~ [email protected]
;laksdfhjdhksalkfj more things ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.