Hacker News Comments on
Design of Computer Programs
Hacker News Stories and CommentsAll 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" in Python where you can learn his thought process on how to write reliable and beautiful software to solve interesting problems.
I quite enjoyed https://www.udacity.com/course/design-of-computer-programs--... -- program design by Peter Norvig. (Disclaimer: I had a very small part in preparing it.)
⬐ hiyer+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: https://www.udacity.com/course/design-of-computer-programs--...
Granted, I haven't actually paid them any money.
⬐ wlNorvig 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 (https://www.udacity.com/course/design-of-computer-programs--...) 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.
⬐ zerrThe 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.⬐ pvg⬐ dpflanHe's not really trying to teach you poker or even how to write a poker program but rather how to solve problems by programming.⬐ zerr⬐ Err_EekSolve 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.⬐ sotojuanGP 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.⬐ solaxunGreat 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.⬐ abecedariusSome 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.)⬐ Err_EekAt one point I a friend was mentioning the regex golf https://xkcd.com/1313/ 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: http://greenteapress.com/wp/think-python-2e/
Polya's How to Solve It: https://en.wikipedia.org/wiki/How_to_Solve_It
Udacity's Design of Computer Programs: https://www.udacity.com/course/design-of-computer-programs--...
⬐ tapan_kThank 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.⬐ amgandothere's also Clean Coders: https://cleancoders.com/videos/programming-101
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.⬐ louhikeIt'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 - https://www.udacity.com/course/design-of-computer-programs--...
> 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: https://www.udacity.com/course/design-of-computer-programs--...
And here's one of the early machine learning courses: https://www.udacity.com/course/intro-to-machine-learning--ud...
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 - https://www.edx.org/course/analytics-edge-mitx-15-071x-0
Design of Computer Programs - https://www.udacity.com/course/design-of-computer-programs--...
If I had more time I would love to go through the bioinformatics specialization on Coursera. They have 2 books and an exercise site (rosalind.info). It looks like great fun.
⬐ geomark+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 https://www.coursera.org/course/statistics⬐ amykharDesign 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" (https://www.udacity.com/course/cs212) 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.
⬐ stevenspasboI didn't realize he taught any udacity courses, thanks for the link!⬐ dm03514I 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 :)⬐ innguestGoogle 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  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  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 . 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  might by a good fit.
Among the various Python Courses, I would probably go with Udacity's Design of Computer Programs: Programming Principles  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.
⬐ bredmanThanks! 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 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 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, ...
⬐ wapsExperience 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.
* 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 
* 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) ...⬐ allardwhy isn't it Stanford's manual?⬐ waps⬐ dteohHeh. 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.⬐ wapsYou 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"](https://www.udacity.com/course/cs212) 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 https://www.udacity.com/ 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 - https://www.udacity.com/course/cs101
2. Building a HTML5 game - HTML5 Game Development - https://www.udacity.com/course/cs255
3. Building a Blog - Web Development - https://www.udacity.com/course/cs253
4. Building a Browser - Programming Languages - https://www.udacity.com/course/cs262
5. Building blocks of any non - trivial software project - Design of Computer Programs - https://www.udacity.com/course/cs212 .
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.
⬐ tekromancrThe intro course is also worth taking a look at.
You can also take a free course online (https://www.udacity.com/course/cs212) by Peter Norvig with Udacity (https://www.udacity.com/) in case you can't make it to hacker school.