11 ms·
How to Design Programs (2014)
- adamnemecek 6y agoI never understood the appeal of this book.
- spekcular 6y agoI never understood the appeal of this, or SICP, or Scheme in general. I learned much more about computer science reading algorithms and data structures textbooks, especially Knuth. There's a reason MIT uses Python for its intro courses now, after all.
- ska 6y agoMIX/MMIX are close to how CPUs work physically. scheme is close to how computation works theoretically. The pedagogical approach that appeals to individuals tends to align with how they are most comfortable thinking about it.
- spekcular 6y agoLet me say something that may reveal my ignorance, but which I'm very happy to be corrected on: for the purpose of writing moderately-sized, everyday programs, I've never needed to understand how computation works theoretically (more abstractly than introductory algorithms and data structures). And that's not because I'm not comfortable with abstraction, or because I don't know how it works theoretically, I just haven't. Further, the obstacles I face when coding are mostly tightly coupled to the fact that I'm programming on physical hardware – again, nothing to do with the theory of computation. Even in a high-level language like Python, if you program the Sieve of Eratosthenes in a naive way without understanding what's going on under the hood with deleting an element from a list, you're going to have a bad time [0]. To caricature SICP-style instruction a bit, I'm imagining someone learning that recursion is useful (Scheme peeps seem to love it) without also being taught it generally has poor performance characteristics. Perhaps a better criticism is the mostly useless emphasis on immutable data structures. The example I like to bring up is how Haskell for a long time didn't have a readily-available hash table implementation for completely ideological reasons. No, hash maps are strictly worse, thank you. [0] https://stackoverflow.com/questions/3939660/sieve-of-eratosthenes-finding-primes-python https://stackoverflow.com/questions/3939660/sieve-of-eratost...
- Jtsummers 6y ago> To caricature SICP-style instruction a bit, I'm imagining someone learning that recursion is useful (Scheme peeps seem to love it) without also being taught it generally has poor performance characteristics. SICP teaches that recursion can have bad performance and how to use it without blowing the stack or wasting time with unnecessary computations. Scheme, the language, requires tail call elimination so compilers will transform tail recursion into something as fast as a conventional loop.
- spekcular 6y agoYes, I agree, that is a caricature. More seriously, I think leaning on this language-specific feature in a book that's supposedly teaching "general programming 101," or whatever, is in bad taste. As it says: > One reason that the distinction between process and procedure may be confusing is that most implementations of common languages (including Ada, Pascal, and C) are designed in such a way that the interpretation of any recursive procedure consumes an amount of memory that grows with the number of procedure calls, even when the process described is, in principle, iterative. As a consequence, these languages can describe iterative processes only by resorting to special-purpose ``looping constructs'' such as do, repeat, until, for, and while. The implementation of Scheme we shall consider in chapter 5 does not share this defect. It will execute an iterative process in constant space, even if the iterative process is described by a recursive procedure. An implementation with this property is called tail-recursive. With a tail-recursive implementation, iteration can be expressed using the ordinary procedure call mechanism, so that special iteration constructs are useful only as syntactic sugar. This is an example of a point where an algorithms book is helpful + clarifying and SICP is really not. (fake quote: "Be conceptually sloppy and let Scheme take care of it, kid.") It has a few pages on orders of growth, but the coverage is not amazing.
- chongli 6y agoI wouldn’t really call tail-call elimination a feature, language-specific or otherwise. Instead, I would describe the lack of it as a bug. If you examine what’s actually going on in compilers that lack tail call elimination, what you witness is the saving of registers to the stack whose values are provably never going to be used.
- bogomipz 6y ago>"MIX/MMIX are close to how CPUs work physically." What is MIX/MMIX? Is this something specific to the SICP book?
- Jtsummers 6y agoFrom Knuth’s The Art of Computer Programming. MIX is the earlier version, MMIX is the more recent (though now 20 or so years old) version. They are descriptions of a computer architecture and machine instructions used to explore algorithms in his books. https://en.m.wikipedia.org/wiki/MMIX https://en.m.wikipedia.org/wiki/MMIX
- astrange 6y agoKnuth's TAOCP was originally written in an imaginary 60s-style CISC assembly called MIX (with some oddities like being decimal) but newer editions are in a RISC style one called MMIX (which Knuth claims is more practical but really isn't.)
- disgruntledphd2 6y agoWell, all I can say about that is that I read through the MMIX supplement and did a bunch of the exercises, and I know have enough knowledge to vaguely understand assembly. It hasn't been massively useful to me in my professional life (I'm a data scientist), but it definitely has helped me to gain a deeper appreciation of how computing works.
- astrange 6y agoBy practical I meant it's hard to implement in hardware. As far as I know it's easy to learn, having register windows is just kind of weird.
- disgruntledphd2 6y agoAh OK. I guess that makes sense (especially as Knuth implemented its interpreter in C, as documented in MMIXware).
- vram22 6y agoBoth understandings are needed for best results.
- deleted 6y ago[deleted]
- flatline 6y agoSICP introduced a lot of fundamental concepts in CS to me as a junior, self-taught developer. Building everything up using immutable functions and then introducing mutable state was revelatory and still influences my design decisions 15+ years on. Scheme was somewhat beside the point.
- qbasic_forever 6y agoSICP for me was the missing link between learning syntax and code to designing actual programs that solve real problems. It made me step back and look at a problem not as something that just needs a layer of code thrown at it, but as a task to complete, with requirements, constraints, etc. to consider before a single line of code is even written.
- wjossey 6y agoWhile I have friends (and many colleagues) who graduated from MIT CS and are very competent engineers, I don't think MIT is the shining beacon of the best SE/CS graduates. Their program is certainly very good, but if someone asked me (for CS/SE specifically) about going to MIT or NU, I'd point them to NU. For almost everything else, it would, of course, be MIT.
- aiisjustanif 6y agoWhat university is NU?
- wjossey 6y agoNortheastern University, which is where the roots of HTDP can be found.
- aiisjustanif 6y agoAh, thank you. I was thinking of Northwestern. To the point of comment you replied too. I do believe there is value in what can be more understood between learning via HTDP vs an easy to understand language, Data Structures, and Algorithms. From stand point of teaching CS to beginners maybe MIT is going for breath and Northeastern is going more for depth. Then again what do I know, I didn’t go to university remotely in that realm of prestige.
- webmobdev 6y agoWhat about Carnegie Mellon or Berkley?
- TeMPOraL 6y ago> There's a reason MIT uses Python for its intro courses now, after all. Yes, and IIRC, that reasons were, roughly: a) Python is more popular, b) Python has better robotics libraries, which is what kids coming to MIT care about these days. Notably, I don't recall the reasons they given having anything to do with giving students a good fundamental understanding.
- spekcular 6y agoBut this is exactly my point. I think it's essentially a myth that Scheme/SICP are somehow more well-suited to providing a "good fundamental understanding." And Python is, as you point out, more practical and accessible.
- ralphc 6y agoHere is Gerald Sussman, creator of SICP and the course, explaining exactly what happened with the switch - https://www.youtube.com/watch?v=cblhgNUoX9M&t=3578s https://www.youtube.com/watch?v=cblhgNUoX9M&t=3578s
- naringas 6y agoI see two sides: the numericals and the algebraists. I've talked with people who also see these two sides but call them differently. As I see it, this book is closer to the algebraists side. Thus, you probably lean closer to the nuemerical side. I also like to think about it as the Turing perspective (numerical, algorithmic) and the Chruch outlook, which is more algebraic-symbolic. At the end of the day, it's both "contrasting" viewpoints coming together that truly animates the science of computing.
- mmcdermott 6y agoThe part about the two mindsets sounds vaguely familiar. Is there an article or blog post that lays this out in more detail?
- SourPatch 6y agoThis might be what you're thinking of: https://en.wikipedia.org/wiki/Worse_is_better https://en.wikipedia.org/wiki/Worse_is_better
- linguae 6y agoA good paper describing functional programming and also talks about the differences between these two mindsets is "Conception, Evolution, and Application of Functional Programming Languages" by Paul Hudak (1989). You can find a copy at https://courses.cs.washington.edu/courses/cse583/00wi/p359-hudak.pdf https://courses.cs.washington.edu/courses/cse583/00wi/p359-h....
- tjr 6y agoSome people prefer not to commingle the functional, lambda-calculus part of a language with the parts that do side effects. It seems they believe in the separation of Church and state. --Guy Steele
- jimhefferon 6y agoThank you. One of the funniest things I've ever read.
- billfruit 6y ago'Concepts, Techniques and Models of Computer Programming' by Peter Van Roy and Hadidi may be a better book than this and even SCP, since it presents a well organized "science" of computer programming..
- notapenny 6y agoI've read both SICP and CTMCP and would recommend the latter as a first read. Sure the language it teaches in is not practical, but I actually found that to take away the distractions of reading a book in whatever your target language is. Also its the first book that got me thinking about how programming languages actually work and what actually happens under the hood when you're writing code. Great book.
- billfruit 6y agoI also like that it is a very comprehensive book, it covers almost all fundamental approaches to programming, and clearly sets out their scopes and limitations.
- sevensor 6y agoThis is a book that embodies its thesis, that learning to design programs is like learning how to write or do mathematics. In the same way that academic treatments of writing or math abstract out the things you might actually do with writing or math, HTDP abstracts out the things you might actually do with a computer program. Instead you work through exercises that illustrate the fundamental concepts. I don't know that a practicing professional will learn all that much from HTDP, but it's an interesting perspective all the same.
- samth 6y agoAre you saying the examples in the book are insufficiently real-world (ie, they should be more like creating websites and less like Tetris [https://htdp.org/2020-8-1/Book/part_two.html#%28part._sec~3atetris%29 https://htdp.org/2020-8-1/Book/part_two.html#%28part._sec~3a...] or XML [https://htdp.org/2020-8-1/Book/part_four.html#%28part._ch~3amoney-sexp%29 https://htdp.org/2020-8-1/Book/part_four.html#%28part._ch~3a...])?
- sevensor 6y agoNo, I think that would be a lazy and unjustified criticism. My remarks shouldn't be taken as criticism at all. In the same way that a calculus textbook has the student work carefully constructed math problems, HTDP has the student work carefully constructed program design problems, always at exactly the right level to stimulate growth. My point is more that the setting is as different from ordinary software development as a calculus class is from the work of electrical engineering. This isn't a bad thing; just as everything I learned in calculus class helps me in my work as an engineer, everything I would have taken away from HTDP had I been taught with it as an undergraduate, would help me now. Instead, having read through most of HTDP long after my school days, I've concluded that it's a very good, systematic treatment of a subject I learned in bits and pieces along the way.
- dangrover 6y agoMy undergrad intro class used this. At the time I found it patronizing and silly and artificially limiting, having coded before (the design recipe, the different "levels" of scheme). But I saw some of the wisdom in the approach when I later tutored the class. People would try to rush into coding problems without doing real analysis of what the cases would be, and had a foggy notion of different parts of program having a "contract". HTDP and the design recipe makes that muscle memory for beginners which is pretty nifty.
- stephenhuey 6y agoMatthias Felleisen was my professor at Rice 2 decades ago and I can still hear his distinctive voice clearly in my head! I too was resistant at first having done some programming in high school, but I wish I could go back and tell myself to pay attention more. Now I know Matthias was both wise and passionate and that combination doesn’t show up in every CS class, so to this day I’m nostalgic for the way he introduced computer science.
- qez 6y agoFelleisen taught the first CS class I ever took. I think part of the point of the class was to mess with people who think they know what to do because they've coded before, when in actually they are now on even footing with everyone else. In my position, I was glad for it. Everyone was perfectly intuitive!
- jasonjayr 6y agoI was also a student of Prof Felleisen, and his class was both challenging and rewarding if you could stick with it. Among other things, I learned one of my most memorable quips from him: "Don't put your ego in your code." Basically: don't consider attacks on the quality of your code as attacks on the quality of who you are. Learn, improve, and teach others the same.
- tacon 6y agoBack when Felleisen was at Rice, he was the faculty sponsor for the Houston Java User Group. I attended some of those meetings, and Prof. Felleisen was mostly sitting quietly in the back of the room. Then a few years ago I ran across HtDP, and I am kicking myself for not noticing what I was missing. I should have dumped the Java meetings and sat in on his classes...
- procload 6y agoWhy is this posted again today?
- brudgers 6y agoThere was this question about books on software engineering. https://news.ycombinator.com/item?id=26488944 https://news.ycombinator.com/item?id=26488944 I saw it was at least a couple of years since HtDP was discussed on HN. I appreciate its flat footed approach and systematic method. To me, these are hallmarks of professional engineering practice. There's no attempt to make the problems more interesting by adding complexity or affectations. YMMV.
- gwern 6y agoHanson & Sussman have a new SICP-related book coming out which tackles similar topics: https://mitpress.mit.edu/books/software-design-flexibility https://mitpress.mit.edu/books/software-design-flexibility This post may ultimately be downstream of people thinking about software engineering/CS textbooks and comparing.
- avinassh 6y agoJust checked, seems this book is already available to purchase. Released on 9th March
- neilpanchal 6y agoThe design and aesthetics of this book template is exemplary. No purple rounded corner bs, huge fonts, excessive negative space, garish colors, etc. We need to do this more please.
- unreal6 6y agoI find Scribble [1], Racket's documentation tool to be easily readable and accessible. I wish more projects utilized it. [1] https://docs.racket-lang.org/scribble/ https://docs.racket-lang.org/scribble/
- neilpanchal 6y agoThanks, TIL Racket is a programming language for languages: https://racket-lang.org/ https://racket-lang.org/
- morty_s 6y agoOh wow. I love SICP. I still pick it up every now and then—just for the poetry. The intro CS course I had taught from SICP (but the course was python, & scheme, & sql). I wasn’t so interested. I didn’t read or see the book until months after the course ended, but by then I was hooked. I’ve never heard of HTDP, I can’t wait to read it.
- EdwardDiego 6y agoWhen I was self-teaching, I found SICP a bit hard to really get into, luckily someone in comp.lang.lisp recommended HtDP, and I was golden, going to SICP after HtDP was a lot easier.
- andreygrehov 6y agoIf anyone is interested, there is also a YouTube course based on this book: https://www.youtube.com/playlist?list=PLA_-EWSPTJcuy5VyJyvemxydu16kcAK0S https://www.youtube.com/playlist?list=PLA_-EWSPTJcuy5VyJyvem...
- bckr 6y agoThanks for sharing, I'll definitely get into this.
- wjossey 6y agoBack in 2008/2009, I was lucky enough to be in the NU PhD program straight out of undergrad. I had the amazing opportunity, as a TA, to teach this curriculum in the second-semester CS course that all of the CS/SE students went through. This curriculum, along with NUs co-op model, creates some of the most spectacular engineers I've ever had the pleasure to work with. HTDP gives them the tools, and the the co-op gives them the experience. By the time they graduate, they are immediate contributors who are ready to accelerate and grow rapidly during those early years of their career. While my undergrad experience was exceptionally different (yet equally transformative), if I could recommend a model for teaching software engineering, it would be the structure developed by the folks who created HTDP.
- adjkant 6y agoSpeaking as a combined BS/MS grad who TA'd the first semester intro course for 6 semesters and had the pleasure of having one of the authors advise me on a senior project type thing, a big +1 to this. I sometimes feel like I'm crazy when I tell people I wouldn't pick nearly anywhere else for undergrad CS, but time after time when I compare with peers on their experience, this model really is incredibly different and only a few others schools use it (the list is growing, but notable ones being Brown and Waterloo). If anyone wants a high level overview of the approach, I can't recommend this essay enough: https://felleisen.org/matthias/Thoughts/Developing_Developers.html https://felleisen.org/matthias/Thoughts/Developing_Developer...
- bostonsre 6y agoI went through the coop program at northeastern and it was amazingly pragmatic. You go to school for a career and they put a large focus on that part. They had classes like building resumes and their internship pipeline was amazing. They have tons of connections with companies and they help you with getting your foot in the door somewhere. After my first coop stint I kept working there part time through classes and I never stopped working through the end of school. I had a career and experience before I even graduated. Also, the comp sci classes were amazing like you said. I started out as a bored business major and took the intro class that used htdp and it immediately changed the course of my life.
- vinceguidry 6y agoI'm a bit sad that contracts became the enduring legacy of HtDP and all the brilliance of the approach to recursive programming was just tossed by the wayside by the "digerati". I would have really liked to use those tools in my professional life. I guess the idea of giving up the compile step was way before its time.
- 127 6y agoRecursion is all fine and dandy when you have TCO. Most languages don't.
- butterisgood 6y agoAnd even in the ones that do, you often want a trace (which you can get fairly often) when debugging.
- wffurr 6y agoIs the stack trace for a TCO recursive loop really that different from a function with a loop in it? You still see the caller and the state of the loop like recursion.
- bogomipz 6y agoI see a lot of mentions of SICPm, it this book meant to be an update of or at least inspired by SICP?
- deleted 6y ago[deleted]
- ddek 6y agoIt's often labelled as a more accessible alternative to SICP, mainly because it's lisp-based.
- culturedsystems 6y agoIt is inspired by SICP, but in the sense that it fixes what the authors consider to be problems with SICP's approach. They've published various papers on their criticisms of SICP, eg http://www.ccs.neu.edu/scheme/pubs/jfp2004-fffk.pdf http://www.ccs.neu.edu/scheme/pubs/jfp2004-fffk.pdf
- Gene_Parmesan 6y agoI am self taught, I worked as a lawyer for six years and four of those were spent prepping for a career change - self-teaching comp sci and software dev in the evenings, then working as a volunteer a few years in. (I come from an engineering family and should have just done it from the start, but oh well.) I'm not sure if it's still on the platform, but about a year into my self studying I took a series of courses on edX that used this system. I think it was called Systematic Program Design, but I could be misremembering. Anyways, the courses were incredible. I completely credit them with beginning to turn me from a coder into a software dev. The system they provide just locked into my brain like it had always been there. I almost didn't take it because it used Racket, and I questioned its general applicability for that reason. I'm so glad I pushed those concerns aside, because in addition to introducing me to software design principles, it introduced me to Lisp in a way that also completely changed my thinking about what programming itself could be. I've now been a paid dev for 2.5 years. I don't really explicitly use the system from the course in my daily work, but the knowledge contained within it has molded my entire understanding of the field. The course literally changed my life.
- wjossey 6y agoOnce a SE discovers that they can learn, quite significantly, in a language that may have very little practical day to day use, it's a powerful moment. Sometimes the best tools for teaching aren't the tools we need in our day to day work, and that's ok. When you're in learning mode, it's about discovering those foundational blocks upon which all else is built. Those fundamental blocks are never the actual programming language itself.
- dopidop 6y agoWell said. On the day job, I wish for the level of expression of a different paradigm. I sigh at the entanglement of information that is presented to my kind. And when comes the evening, I’m relying on cheap tricks and iterative steps because I’m fried and human. That’s a bitter sweat thing, that you describe.
- tartoran 6y agoI've had that moment and it's a paradigm shift in thinking. I'm still on my first leg of my journey as I started learning Racket/Scheme relatively recently but I've already started seeing things in a different light. I almost don't care about performance (at this point) as I know that could be attainable somehow once a solution is fleshed out but I simply enjoy the understanding of the concepts and the patterns that arise. At this moment I see possibilities all around and feel quite electrified.
- eyelidlessness 6y agoI don’t mean to crap on something that might be great but... has anyone tried to make this usable on a phone or for even moderately poor vision? I barely noticed there was actually content to be accessed at all, just a tiny “next” black on darkish grey link.
- adjkant 6y agoThis is basically just Scribble (docs for Racket). If you have input, I'd venture to guess contributions are more than welcome! https://docs.racket-lang.org/scribble/ https://docs.racket-lang.org/scribble/
- eyelidlessness 6y agoI didn’t know! My time is pretty full right now, but I’d like to get some time with Racket and I’ll take a look if I get some space for it.
- uxp100 6y agoThat is always the response when people point out scribble output is unusable on many phones. But in fact people have offered fixes and they were rejected. Were they high quality fixes? I don’t know, not knowledgeable about CSS. I don’t think the project maintainers consider being useful at all on mobile a goal of scribble. So I would say, contributions do not seem to be welcome on this topic.
- uxp100 6y agoAnd here is the relevant issue if you want some CSS that might work a little better: https://github.com/racket/scribble/pull/62 https://github.com/racket/scribble/pull/62 It's pretty clear from this that scribble will never support mobile. I can't remember if I pulled the CSS from this change or if I came up with something myself, but making it work slightly better on my phone at least was a pretty small change, not sure if I have it around still or not.
- dang 6y agoThe interesting previous threads appear to be: How to Design Programs, second edition - https://news.ycombinator.com/item?id=16561815 https://news.ycombinator.com/item?id=16561815 - March 2018 (30 comments) How to Design Programs, Second Edition - https://news.ycombinator.com/item?id=14932552 https://news.ycombinator.com/item?id=14932552 - Aug 2017 (40 comments) How to Design Programs - https://news.ycombinator.com/item?id=12768134 https://news.ycombinator.com/item?id=12768134 - Oct 2016 (3 comments) How to Design Programs, Second Edition - https://news.ycombinator.com/item?id=8778569 https://news.ycombinator.com/item?id=8778569 - Dec 2014 (39 comments) How to Design Programs, Second Edition - https://news.ycombinator.com/item?id=6150967 https://news.ycombinator.com/item?id=6150967 - Aug 2013 (26 comments) How to Design Programs, Second Edition - https://news.ycombinator.com/item?id=2958108 https://news.ycombinator.com/item?id=2958108 - Sept 2011 (18 comments) How to Design Programs: An Introduction to Computing and Programming - https://news.ycombinator.com/item?id=2049477 https://news.ycombinator.com/item?id=2049477 - Dec 2010 (17 comments) How to Design Programs - https://news.ycombinator.com/item?id=637152 https://news.ycombinator.com/item?id=637152 - June 2009 (4 comments)
- zerr 6y agoHow common is the usage of linked lists in real world Lisp projects? Isn't the prevalence of this data structure in books encourage writing inherently inefficient programs?
- deleted 6y ago[deleted]
- FranzFerdiNaN 6y agoAnother teaching language is Pyret and the book Programming and Programming Languages. It actually came out of HTDP, but uses a more Python-like syntax and explicitely uses types. https://www.pyret.org/ https://www.pyret.org/ https://papl.cs.brown.edu/2020/ https://papl.cs.brown.edu/2020/
- exdsq 6y agoWould you recommend this to a self-taught dev with 7 years experience in tech?
- Tarq0n 6y agoThese discussions often revolve around introductory or 'first' books. What are some good followup books to HtDP, or books for an intermediate audience?
- random_coder 6y agoUsually SICP is recommended as a follow up to HtDP. It's freely available at https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book.html https://mitpress.mit.edu/sites/default/files/sicp/full-text/...
- FearlessNebula 6y agoI'm 6 months into my career and wondering if this is worth reading
- hackermailman 6y agoPAPL is sort of the sequel or plai.org https://papl.cs.brown.edu/2020/ https://papl.cs.brown.edu/2020/
- comeonseriously 6y agoA little bit of code sprinkled with a little bit of abstraction. Not too much of either.
- rafaelferreira 6y agoKathi Fisler gave a great talk at the latest racketcon about research done based on the HtDP curriculum. I thought it was interesting to see the sorts of problems that fit well with the basic structure templates given in htdp and the kinds of problems that were a bad fit. https://www.youtube.com/watch?v=MnrRUdbOW1M https://www.youtube.com/watch?v=MnrRUdbOW1M
- grey4228 6y agoThank you for the link.
- benjaminclauss 6y agoMatthias is an awesome professor. His blog/Thoughts page has a lot of great content. https://felleisen.org/matthias/Thoughts/index.html https://felleisen.org/matthias/Thoughts/index.html