Ask HN: Is SICP/HtDP still worth reading in 2023? Any alternatives?
I'm a self-taught programmer but I recently realized I need to really understand how to write programs elegantly. GPT-4 was a huge motivation for this because whenever I asked it to rewrite the code like a professional Python programmer, it would come up with amazing things. But after GPT-4 became nerfed by OpenAI, I felt a void: how can I keep writing elegant programs? My answer is: I should learn how to do that myself.
SICP uses Scheme, which I don't mind. My main concern is that it's an old book. Are there ideas and concepts not discussed in the book which are crucial in today's programming landscape? Will I be better off reading a book that uses Python in the first place?
101 comments
[ 2.3 ms ] story [ 175 ms ] threadi say this as someone who has not read either of those books and doesn't even know what the acronyms refer to: knowledge is good. it'll take you many years to re-learn the knowledge that is already written in those books if you don't read them.
there is a practical limit to how much knowledge you can just throw into your brain, but these surely must be some important and well-renowned books if you throw out the acronyms without clarification, so i doubt the ROI could possibly be negative
It may not align with your ambitions as a programmer, but math and functional programming still apply.
There are video lectures you can use to accompany the book: https://youtube.com/playlist?list=PLE18841CABEA24090
Also, I highly recommend the courses How to Code: Simple Data amd How to Code: Complex Data on edX that are based on HtDP.
https://en.wikipedia.org/wiki/Gregor_Kiczales?wprov=sfla1
I took the course in 1999.
And yes the material is just as relevant today.
Not everyone uses geometry every day, but engineers do. And we all depend on engineers, so the understanding of geometry is a fundamental underpinning of our entire society. The same can be said of computer science. We don’t all program for a living, but the structure and interpretation of computer programs (the literal structure and interpretation, not the book) is becoming an ever larger factor in how our society functions.
I think Sussman's answer is more of an observation of the result of the switch and not an explanation why. MIT is a slave to fundraising, and I suspect the industry trends of programming languages, funding sources, job market, and other marketing and political decisions led to the change over anything actually technical.
That was my journey as a self-taught programmer who at one point realized had to learn the timeless foundations.
And then MIT's 6.005 [1], where you will apply all this with a realistic language (Java, although the concepts carry to any language), and learn how to design, code and test programs that "have no bugs, are easy to understand and ready for change".
And also learn a bit about algorithms, I don't think that one can design and understand properly without. And what is O(2^n) today will still be that in 100 years. MIT's 6.006 is amazing, both professor and TA [2].
I've seen Knuth's TAOCP recommended around here. Don't even consider that, do a course like 6.006 first, the Everest shouldn't be the first mountain you climb. Likewise favour HtDP over SICP at first, I've been there.
If after all this you are still interested in LLMs, I recommend EdX's "Large Language Models: Application through Production" [3]
[1] https://ocw.mit.edu/courses/6-005-software-construction-spri...
[2] https://ocw.mit.edu/courses/6-006-introduction-to-algorithms...
[3] https://www.edx.org/course/large-language-models-application...
Worst case, they find it too elementary and wasted a few weeks or months.
I wish I learned it earlier in my life. Before I realized what you said, I procrastinated on so many books and never started many I wanted to read.
After I realized this, I finished way more books, and learned many new things even when I didn't finish books. You don't need to finish books to learn new things that make you better.
Even you read four chapters of a book, you are still those four chapters wiser than yourself who hadn’t read those four chapters.
Do the exercises too!
Let me disagree here: right now I’m doing mentoring with some python programmers where I work, they watch the videos, read the relevant part of the book, and we have a discussion together after each part. I hear constantly “oh yeah, I can apply that here or there”, “this streams concept is so good”, etc etc etc. I think it is most valuable if your background is “only” Algol family languages.
It's certainly not required reading to be a successful programmer in the 21st century, but like SICP, it offers a different way of looking at things that may help influence some of your decisions on how to build something.
Hopefully someone else can provide a review?
SICP provided a different way of understanding programming. I enjoyed the class, did well, and became a big fan of Scheme for quite some time.
But the text was written for a different era, one dominated by C, PASCAL, and COBOL and when parallel programming was rare. In a time where almost all programming required working with low-level, basic programming constructs designed around the CPU's architecture, using Scheme to teach future non-academics was a great way to open their eyes to different ways of thinking about programming.
But it's close to the 40th anniversary of the first edition and past the 25th anniversary of the second. A four core CPU is low(er) end. Phones have 4+ cores. Even watches have dual-core CPUs. Ruby, Java, JavaScript, Python, Go, Rust, and a zillion frameworks are all available and widely used.
It wasn't possible to get performant Scheme on the hardware of the time. Now that we have the hardware, other languages have taken what Scheme could do and done it better.
Are the concepts useful? Certainly. But if your goal is to be a better programmer now, I'd pick a different book. If you're a Python programmer, pick a (modern, recent) Python book. If you're a JavaScript dev, then a (modern, recent) JS book.
If SICP was teaching woodworking, it would be the no power tools, start with a standing tree method. It's fascinating, it's neat, there are cool concepts to learn. But it's of little relevance, day-to-day, in a world filled with tools that let you focus on the goal instead of a million tiny details.
I don't consider languages with these features lisps, but I think the GP's statement is only quite mildly hyperbolic.
SICP is more like studying the actual composition of wood itself than it is about tools. this is still important whether youre using new or old tools.
Power tools are accelerators, not fundamental tools. Your analogy of woodworking is excellent, but I believe you draw the wrong conclusion from it.
This attitude is why my 16 core machine with 100Gb of ram feels about as fast as my Windows 95 machine felt 25 years ago. It's why software seems to scale with the computers that run it.
GP: Read SICP. even if you don't end up writing any Scheme, you'll be a better programmer for it.
I can't compare them to SICP, but if your only concern is the relevance of the examples then these may be worth looking into as a supplement or replacement for the original.
If it isn't stop and set it aside for later. Because your future self might be one of the people who thinks it is worth reading.
If it is, keep reading until it isn't. By "keep reading" I don't necessarily mean reading as if cramming for an exam. It's ok to read books slowly. Just as it is ok to not finish books (sufficiently slow reading is indistinguishable from not finishing a book). Good luck.
SICP = Structure and Interpretation of Computer Programs: https://mitp-content-server.mit.edu/books/content/sectbyfn/b...
HtDP = How to Design Programs: https://htdp.org/
Sometimes I think gratuitous use of acronyms (initialisms for the pedants) has been the biggest impediment to learning throughout my career.
I think IT reached bottom when we started using numeronyms like L10n (localization) or K8s (Kubernetes).
I agree. That practice is the worst.
"My article is about How to Design Programs (HtDP)..."
Then later the article: "In the HtDP book it mentions...."
This makes life easier for those less familiar with the subject matter.
As a software developer with a forty year career behind me I'm quite familiar with the "SICP" book. But for some reason my brain won't persist the connection between the full title and the SICP acronym when I bump into it. Yet somehow I can recall what each and every assembly language mnemonic means across a fairly broad range of micro and mini computer processors.
> maybe that's a sign that particular thread isn't for you, and that you likely have little of value to add.
Sure I may not have much to add, but the reason to read a thread, article or essay is to become familiar with the subject matter because it sounds interesting. Don't assume your reader is an expert in decoding your special and often made up acronyms.
> TAoCP (er, Knuth's "The Art of Computer Programming")
I also would not have recognized TAoCP as referring to the Knuth book. Not all corners of the tech world commonly refer to tech books by their initials. That doesn't mean they have nothing useful to say about them.
Acronyms and initialisms with no explanation are passive aggressive gatekeeping.
OTOH it's really important to spell them out at a right time, to help people not yet in the know understand them. So thank you!
On the other hand - HtDP is explicitly focused on teaching you patterns of thought that will help you create well-structured programs. It's also significantly easier, so I'd recommend it for your purposes full-throatedly.
I always feel like I'm missing out on some sort of magical programming secrets that will expand my mind like a spiritual retreat when I'm in these threads. But it's just CS 101 except you use Lisp? I don't get it.
SICP's big mind-expanding thing is that it teaches CS 101 through the process of building, from within a computational system, an entirely new computational system - various kinds of programming languages and later even a machine and compiler. In this sense it kind of peels away a lot of the magic of how computers and programming languages work. For lots of CS students - and even professionals - who've never really thought about what makes their Python interpreter tick, that's a big discovery. It's also a real pedagogical feat.
https://dcic-world.org/2023-02-21/index.html
Do you have any examples you can share of GPT4 being degraded?
From this recent study: https://arxiv.org/pdf/2307.09009.pdf
> For example, GPT-4 (March 2023) was very good at identifying prime numbers (accuracy 97.6%) but GPT-4 (June 2023) was very poor on these same questions (accuracy 2.4%).
There is more in the study but I just grabbed a short snippet as an example.
And that is just taking advantage of 1% of it.
HtDP is also worth taking a look at, and is much easier than SICP.
LLMs will mostly statistically plagiarize code. (Some people will rationalize "The tool generates the boilerplate, so that I can focus on the harder problems, because I am a mental giant who is above mere coding, and this is totally not open source code laundering", and then slap the code into a Git commit with their name on it, while making "cha-ching" cash register sounds.)
Instead of LLM, if you want to learn from other people's open source code, you can just read it in the original form (and not pretend you wrote it).
You can also practice writing your own code. Find things you want to do, and instead of using an LLM or Googling for something to copy&paste, work through the problem yourself, and build that understanding and mental machinery.
And when that starts getting routine, experiment with different approaches within the same language, as well as with different languages. You will add to your toolkit of approaches, and start to build up a feel for when they are appropriate, and various implications.
Advanced, once you have some basic programming skills: Start building things that have to work reliably and securely, have to be maintainable and evolvable at a good cadence, have to be done in the context of a team where everyone is working towards product success, etc.
The flip side of this is that there's a large corpus of programs demonstrating idiomatic python. "There's only one way to do it," was a mantra I heard from Pythonistas in the 2000s. Maybe it's still a cultural value in that community. That would explain the large corpus (that and it being a popular language.)
I've yet to see a LLM spit out even half-way decent Lisp (CL, scheme or even e-lisp). My suspicion is the corpus of available code is small and its language features tend to generate less "boilerplate."
Having taught "practical lisp" in the 90s, SICP was frustrating because of its insistence on describing idiomatic Lisp in text, but with far fewer examples than comparative texts in other languages (k&r c or PASCAL User Manual and Report.)
There seems to be a tradition of this in Scheme and CL books. Where you could easily find books in the 80s entitled "${N} PROGRAMS IN BASIC" or some such, which were useful to provide a corpus of idiomatic code learners could use to build an intuitive understanding of the language. In the Lisp world no such books were available, and members of that community seemed to want learners to develop a wholly rational approach to learning.
So... if your purpose is to have a language that can be generated by ChatGPT, definitely pick Python. My experience with automated tools is they absolutely do not understand how to refactoring lisps effectively.
Then what does that make Hy language?
https://hylang.org/
Re Languages with lots of example code and LLM’s
With translators or things like Hy lang, one could get the LLM’s to solve your problem in Python before converting it to another form. Then, you just need a translator. If lacking one, it’s easy to translate by hand.
The practicality of this concept will probably vary by use case. My experiments had GPT doing sketching, implementations, boilerplate, and even porting Python to Rust. A legally-clear LLM trained on multiple languages could probably be fine-tuned to do Python to LISP conversions. If not, Hy might be a stepping stone, too.
For instance, I was exploring two ideas. One was how to turn Python into something with no dependencies, more powerful, and fast. I considered converting it to Lisp to use their compilers and macros. Another exploration was, like ShedSkin, converting it to C/C++ but without Python dependencies. It would be easier for me to generate code from Lisp syntax than Python syntax.
So, you know, just sharing tools that might get people’s minds going.
https://github.com/atisharma/llama_farm/tree/main
The AI's have limited ability to either handle large documents or track conversations. This tool is an attempt to solve that problem. It works with OpenAI and open-source AI's.
Well, Lisp is noted for its terse and succinct notation [1], so it makes sense that, LOC-for-LOC there is less of it around than Python.
________________
[1] I am told. I wouldn't know. I'm a Prolog programmer.
Care to elaborate on this? I didn't have access until recently, is there really that much difference in performance?
This is a thing that I miss about C++ programming language, third edition by Stroustrup. The "Design using C++" section of about 100 pages in the end made me, at a time, better programmer. I do not read it now, though, to keep my good memories about it =)