I have been watching through the SICP video lectures available from MIT, and I have noticed a profound effect on my personal coding style. I have always enjoyed functional programming, and Lisp and Scheme have long been my favorite languages. But to hear how Sussman and Abelson present the important concepts has impacted the way I think about programming.
The primary component of this new understanding is what Abelson refers to as “programming by wishful thinking”. I’ve read about “design by contract”, and a whole host of other quasi-popular methods for designing programs, but nothing matches the power of wishful thinking. Functional decomposition is becoming incredibly natural to me, in a way that is tremendously enlightening.
Now, instead of wondering how I am going to implement everything from the ground up, I just assume that, at some point, I will. I am starting to build my programs with the interface/API that I want to use, and just expecting my future self to satisfy my present self. It’s such a remarkably fun way to program, I wish I’d found this idea much sooner!
I.e., a program starts with a complex idea:
(define (complex-idea what-I-need-first) (do-stuff (alter-state what-I-need-first))
So now I have a complete, working wishful program. If only it meets those two functions that, were this a real problem domain, make perfect sense to the reader, it will work flawlessly! So I just implement those new functions with the same wishful thinking. Eventually, I get to the bottom of my conceptual stack and have a perfectly working program, with multiple layers of abstraction that appear along natural abstraction boundaries tuned to the way my mind perceives the problem.
How could anyone not think that’s fun?