Deep thoughts 🤔
The unbearable lightness of programming
I like Lego. I was delighted to introduce the composable building blocks to my two daughters. There’s something very satisfying about them. They’re incredibly tangible. And their use is self-evident. Once you play with them a bit, you quickly see how they work. Those little circles on the top connect with the holes on the bottom. Find a circle, and you can build on top. Even my two-year-old could figure them out. And you can feel that they’ve made a good connection.
We often use the metaphor of Lego bricks for modular software components—and the comparison works. Software modules, like Lego bricks, can be put together and taken apart. They are each decoupled with a standard interface.
But metaphors can be stretched too thin. An essential aspect of Lego is the evident design and tangibility. We don’t have that in software. While my daughter both picked up Lego quite quickly, they have no idea what programming is, even though I’ve done it in front of them many times. They think daddy pounds on a keyboard all day.
Programming is too abstract to learn by observation and mimicry. There’s too much going on between our ears. It’s neither tangible nor self-evident.
In this talk, Alan Kay talks about ways to remedy that. For music, there’s the Suzuki Method. For general education, there’s the Montessori Method. Both make learning tangible and immersive. In the same talk, Jørgen Big Knudstorp says that a set of 6 original lego bricks can form 915 million different combinations. Some of them may have never been constructed in the history of Lego.
I’ve often wondered what it would be like to make programming more tangible and obvious. I’ve fantasized about building a program on the kitchen table with my kids watching and helping out. I’ve dreamed of showing a program I’d created to my non-programmer friends so that they could relate to what I was doing. Programming was a lonely pursuit that my friends could not appreciate.
Making programming tangible is incredibly difficult. Lego has the good fortune of being a geometric shape made to build larger geometric shapes. In its simplest form, programming is about processes and, in its grander form, about systems. How do you translate geometry into processes and systems?
Luckily, we can create some intricate systems with very little logic. For instance, you can program a line-following robot with a simple loop and a sensor. You can make an automatic dog feeder by checking if the food in a bowl is below a certain level and opening a door if it is.
The dog food dispenser is a clear example of a system: One third is machine (dispensing). One third is canine (eating). And one third is human (refilling). Perhaps you don’t need long programs if you have the proper constructs and operate in a physical world. Most of the system comes for free!
If the programs are short enough, maybe we could lay them out in space, on the kitchen table, with our kids. It’s the ultimate in programming: Just run the flow chart! Maybe then my friends would be able to get what I do—and play along.
New Clojure Newsletter 📰
Check out Clojure Morsels. It’s lots of great links. If you like this newsletter, you will like it.
Last week on the podcast, I read and comment on Edsger Dijkstra’s 1972 ACM Turing Award Lecture.
Great Talk 🍿
Alan Kay at his finest. He is getting so clear! Making Progress
New Tutorial 👨🏫
I just published a ClojureScript Tutorial. In it, we create a shadow-cljs project, set up Reagent, and build a simple application.
Pandemic update 😷
I know a lot of people are going through tougher times than I am. If you, for any reason, can’t afford my courses, and you think the courses will help you, please hit reply and I will set you up. It’s a small gesture I can make, but it might help.
I don’t want to shame you or anybody that we should be using this time to work on our skills. The number one priority is your health and safety. I know I haven’t been able to work very much, let alone learn some new skill. But if learning Clojure is important to you, and you can’t afford it, just hit reply and I’ll set you up. Keeping busy can keep us sane.
Stay healthy. Wash your hands. Wear a mask. Get vaccinated if you can. Take care of loved ones.
Clojure Challenge 🤔
Last issue’s challenge
This week’s challenge
Write a function that returns the maximum sum of a contiguous subsequence of integers in a vector.
(max-sum ) ;=> 0 ; (sum of empty seq is 0) (max-sum ) ;=> 1 (max-sum [1 10]) ;=> 11 (max-sum [-1]) ;=> 0 (because you can choose the empty subsequence, which has sum 0) (max-sum [3 -6 2 4 -2 7 -9]) ;=> 11 (sum of [2 4 -2 7])
They say you can do it in linear time and constant space. Just make sure it works with large vectors.
Please submit your solutions as comments on this gist.