Notes on getting started with HtDP

I'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 ("", "", 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!
If you're reading this and have some tips to share, leave a comment. Good luck!

No comments: