Notes on getting started with HtDP
Posted On Sunday, March 15, 2009 at at 9:34 AM by mjI've been working my way through How to Design Programs. I'm about 1/3 of the way finished, and have some recommendations for people who attempt to study the book on their own:
- If you are using the dead tree version of the book, be warned that it contains errata. This page is required reading. The online version also contains hints that are not in the physical books.
- There is a DrScheme companion to the book that offers helpful tips.
- Obviously, you should download the latest version of DrScheme to do the exercises with. The book lets you know which language level you should be using by displaying an image like the following (this image is from the online version, which, when clicked, will display instructions on how to change the language level):

- The design recipes introduced in the book are not just something to glance at. They are the heart and soul of learning how to create solutions. If you are not creating data definitions, contracts, purposes, templates, examples, and tests, you are doing it wrong. Not following the design recipes may get you lost.
- Collecting the design recipes and printing them out provides a useful reference.
- When writing tests, use check-expect. The format is: (check-expect expr1 expr2), where expr1 is the value of the function you are testing, and expr2 is what you expect the function to evaluate to. Your check-expect tests go in the definitions window. When you click the run button, a summary of your tests will be displayed to you:
There are 2 mailing lists that can provide help with HtDP self study: the PLT Scheme discussion mailing list, and the Study-HTDP google group. The PLT Scheme list contains Scheme experts (including the folks that wrote the book) and contributors to the environments, languages and modules making up PLT Scheme. The Study-HTDP list contains folks like you working through the book. I've found the PLT community to be incredibly smart, helpful, and friendly.- For each section, I create a new file in DrScheme ("10.1.ss", "10.2.ss"
, etc) using the File->Save Definitions As... menu item. If old definitions are required for the current exercise, the text is good about referring you back to the original exercise. This means opening up the old section file and copy/pasting those definitions into your current file. - Do not give up. If you are struggling with an exercise, take it one step at a time. You should be focusing on the data definition for the class of data you are dealing with, the design recipe for that class of data, your contract and purpose statements, and creating examples and tests. If these don't help, re-read the section. Have you missed something important that the section or previous sections detailed? If none of this turns on the light bulb, ask for help. I've taken the stance that the harder an exercise is to solve, the more important it is for me to solve it, both for being able to continue on with the rest of the book and for personal reasons. Some of the exercises are hard--challenge yourself!
To Read
Posted On Thursday, February 21, 2008 at at 8:00 PM by mjIt's been a while since I've messed around with Squeak/Smalltalk. The Squeak community has been busy! After searching just a little bit, I've found a lot of great catch-up reading:
- Squeak by Example - I haven't gotten far in this, but love it already
- Squeak Development Example tutorial by Steven Wessels
- Seaside Tutorial by the Hasso-Plattner-Institut
- Ramon Leon's blog is always on point
- Mark Miller has written some thoughtful stuff
2007 personal study/projects review
Posted On Friday, December 21, 2007 at at 10:36 PM by mjHere's a break down of how I spent my personal study/projects time in 2007
The good
# of new programming languages studied: 2
Studied programming languages grokked: Squeak Smalltalk
Studied programming languages mostly understood: Common Lisp
The bad
# of fiction books read: 3
# of personal projects completed: 0
# of personal projects started: 0
The fact that I didn't start and finish a single project this year is really disappointing. The reason for this was lack of time. The time that I do have to study and work on projects occurs late at night, usually after the kids have gone to sleep. This year I spent all of it on learning the two languages.
In retrospect, I am very happy to have focused on Smalltalk and Lisp. There is a lot to be learned from both, and the mind expansion you get from studying them is worth it even if you don't end up using them.
For 2008, I'd like to focus on projects. There are several ideas that I have been thinking about for a while, and I'd like to get them out of my brain and functional. Initially these will be done using Django, but who knows where the next year will take things.