Language Oriented Design - CoRecursive Podcast

CORRECURSIVE #039

Language Oriented Design

Discussing SICP with Hal Abelson

Language Oriented Design

Hal Abelson

Adam talks to Hal Abelson about the textbook he coauthored in 1985, The Structure and Interpretation of Computer Programs and why it is still popular and influential today.

Transcript

Note: This podcast is designed to be heard. If you are able, we strongly encourage you to listen to the audio, which includes emphasis that’s not on the page

Introduction

Hal: At some point, we talked about conjuring the spirit of the computer. We actually got some complaints from a couple of MIT students saying, “These guys in this MIT course are talking about witchcraft or something.”

Adam: Hello, this is Adam Gordon bell. Join me as I learned about building software. This is CoRecursive. Today I talked to Hal Abelson. He co-founded the Free Software Foundation, the people behind the GPL, as well as the Creative Commons. But what I’m talking to them about today is the textbook he coauthored the Structure and Interpretation of Computer Programs. So the book uses Scheme and it starts with building procedures and then higher order functions and then interpreters, compilers, virtual machines.

It’s a super interesting book with, I think a unique takes on computer programming. It was originally written in 1985 and still seems super relevant. So we talk a little bit about that as well. Enjoy the interview.

What is SICP about

Adam: I got this email, I printed it out and it says, “Hey Adam, I love the podcasts. Have you ever thought about talking to Hal Abelson and the other authors of the Structure and Interpretation of Computer Programs?” I emailed them before. They’re super nice. Their book is how I fell in love with programming.

Hal: Great. So I’ll be super nice.

Adam: So I have the book and I’m working through it. I hadn’t actually read it before, this is Max, before Max reached out to me. But I had certainly heard of it. So what is the Structure and Interpretation of Computer Programs about?

Hal: Well, it’s basic fundamental stuff about how we think about software design that started out as a textbook for our MIT course. So MIT in the 80’s. Anybody who was going to be studying either electrical engineering or computer science basically started out by taking this course. So the theory was that in either of those fields, you got a pretty deep view of software design and it was a fairly intellectual one. One of the tremendous advantages that Jerry and Julia and I had is that we got to build on, Oh gosh, 10, 15 years of research at MIT that was kind of focused around artificial intelligence.

So one of the things that’s in that book is we started very much from a symbolic computing perspective. And more so we use Scheme, which is a dialect of Lisp, which of course was the AI language then. And it was also fairly mathematical because we aimed it at MIT undergraduates. So it was kind of natural then to start off with examples that had to do with stuff in calculus or stuff in kind of mathematical programming. And that became MIT’s large computer science course. So it’s kind of amazing that course persisted pretty much as it was for, oh gosh 15 years. Which when you think about it, that’s kind of outrageous when you think about computing and how much it’s changed.

But we like to think that’s because the book really is about the fundamentals. So one of the things that we start with is, we say this course is about abstraction and modularity. And everybody says that now, but they weren’t saying it then. So it was kind of, sort of a different, almost philosophical approach to how you think about programs. And the key thing is it says right in the introduction to the book is that, we don’t think of programming so much as a way to get a computer to do stuff as a way to express ideas about how to do things. So one of the things we say in the introduction is, gosh mathematics is about what’s true, form a way to think about what’s true.

Whereas computer programming, computer languages, or computer science are a formal way to think about how to do stuff. So that’s a pretty high level pretty philosophical view but I think that’s successful. I still think that that’s the appropriate way to think about computing. Of course even though so much has changed, I think those fundamentals are still there. And then of course, you’ve got a lot of influence because for the next 15 years, kind of anybody at MIT who did either computing science or electrical engineering took that course. So that’s been a foundation for a lot of people who’ve gone on to do pretty famous things in computing.

Adam: I never thought of that perspective. So in some ways you think it’s popular, just because you had very good students who learned via it?

Hal: That’s always true. I mean, that’s the great thing about being in MIT. I just am consulting at Google and it’s pretty gratifying to you to walk down the hall at Google and all these people stop you. And they say, “Hey, I took your course when I was, and that’s how I really learned about programming got into computing.” So, I don’t want to say we’re totally responsible for that. Maybe you just because we had the tremendous good fortune to teach at MIT, but in any case it was true and it was a nice thing to happen.

A Philosophical Approach to Software

Adam: Yeah, that’s interesting. So I’m working through the book and I’m really enjoying it. I would say it is unique in some of its approaches. So you mentioned this approach that you have that has to do with maybe a philosophical approach to programming. Do you think that’s become more common now?

Hal: Certainly it’s the kind of thing that you can look at everything that’s going on and interpreted that way. Although I don’t think that a lot of people see it even now as sort of in your face as we did in the book. I don’t know it’s sort of funny, if you pick up almost any computing book. Even these days, it starts out saying, “Here are these data types enter at these operations that you do.” And it kind of goes through that whole litany and somewhere around 20 or 30% through the book, they show you how to define a function or a procedure. Whereas we really take the opposite approach.

We say, “The key thing that this is about is, is about abstraction. And one of the key techniques in fraction in any programming language is having procedures for things.” So we kind of start there. So even if you look at most computer languages book, they kind of start from the elements and they say their numbers and floating point and strings and Williams and whatever they are. And for one thing we picked Scheme, which is a latent type language. So we don’t talk about any of that stuff at all.

And secondly, we think the really critical thing is what we call in the book means of combination and means of abstraction of which the primary means of abstraction is defining a procedure. So yeah, I think it’s more common. Everybody talks about abstraction now. But it’s almost impossible to talk about computing and stuff and hey, this is about abstraction, but I don’t think people really follow through in that sense. They just kind of say that.

Scheme

Adam: I think I agree. And it’s interesting what you’re saying. A lot of programming books are about the specifics. So this book is in Scheme. I don’t think that you could really talk about Scheme in the book.

Hal: Right, well, that was absolutely intentional. Because we sort of took the attitude, oh Scheme you don’t have to teach it you just use it. That’s a little bit exaggerated. But even when we did the course, we did very little of presenting Scheme, partly is because there’s almost no syntax. So if you think about what you see in a lot of computing courses, a lot of it has to do with syntax. Whereas Scheme, you just sort of have parenthesized expressions and stuff.

Adam: So do you think is Scheme important to the success of the book.

Hal: Oh, I think so. I think that it’s critical on that. So in terms of when we think about abstraction, one really critical thing is that you’ve got first-class objects and first-class procedures. So if we did this, gosh when did Java get Lambda? Not until Java eight?

Adam: Yeah.

Hal: How long was Java around before they figured it out you want to have Lambda? I mean, you could play this book in JavaScript except for there’s a really important piece missing. Which is because Scheme has such very simple syntax, you can start building interpreters. The extreme hack we did is doing the meta-circular evaluator where you’re writing up the interpreter for Scheme in Scheme. That’d be a little hard to do in JavaScript, without some layers of syntactic processing.

So I think from an educational point of view, when you think about the big ideas, classic ideas about abstraction. And a lot of people are doing that and about abstraction by having as many things as possible being first-class objects. So as I just said, Java has sort of kind of as just gotten there. Since the beginning, I think JavaScript was pretty much influenced by Scheme. But the other piece that’s not missing is that when you writing a complex program, you really should take the attitude that you’re designing a language.

Language Oriented Design

Adam: Yeah. So you called this in the book, the linguistic approach to program design.

Hal: That’s right. So you really take the attitude that, boy if I’m writing something complex, I need to think about what I’m doing as if I’m writing a language. Or just say that a little less onerously. When I think about the operations I want to produce in any kind of program I’m writing, I don’t want to think about only that particular problem I’m doing right then. I want to carve out a space that’s broad enough that I could be doing that particular problem and lots of variations and lots of similar ones.

Adam: Do you have an example of that?

Hal: Well, again, even stuff in the book, if we’re doing something that’s doing arithmetic. Gosh, I not only want to do arithmetic on fixed point numbers. I want to be able to do have their same arithmetic idea going on floating point numbers and even on symbolic numbers. It’s all the same idea. Because tomorrow that algebra routine I wanted to do suddenly wants to be able to work on symbols. So if I think about, I’ve got to just carve out a space of not just doing one particular problem, but having enough room that I can play around. Or as the specs change I can change and do something else more general or more different.

Then I start thinking of what I’m doing not as solving a particular problem or a particular algorithm, but really designing a special purpose language for something. So that’s what we mean by the linguistic theory of design. But then the way that relates to Scheme is you say, well, gosh, the extreme version of that, is we want to give students exercises in writing little languages. What’s nice in those little languages is if the syntax doesn’t get in the way. So as much as people say it’s awkward to be seeing it in fully parenthesized expressions and all of that. If you’re actually writing the language that has to process that stuff, that makes it easier on you as the implementer.

Adam: There’s an interesting example at the beginning that I was just thinking of, which is, we try to approximate the square root of something. And then a little bit later on, I think we use the same technique to approximate something else. And then eventually we’re just approximating things.

Hal: Right? You sort of basically say, “There’s square root and that’s an example of.” Again, it’s all about abstraction, sort of the square root thing, but guess what? That’s an example of Newton’s method. And guess what, at the next level that could be Newton’s method where one of the inputs to your procedure is the actual function you’re trying to approximate. Which comes in as a higher order. I think that might’ve been our first example of a higher order function. That’s part of what I meant by language and abstraction, right? So when I say, “Gee, I want to have a thing that just Newton’s method.” It’s not just doing it for square root and not even just doing it for numerical functions. It could be doing something very general.

Adam: Yeah, it is crazy to think. Well, from my perspective, right? If the book was written in 1985, and you’re saying Java got Lambdas in I don’t know when.

Hal: Just the last couple of years.

Adam: Yeah. So you’re definitely ahead of the curve, is that why you chose Scheme? Are you averse to syntax in all its forms?

Hal: Well, not to. What’s the great quote in there from Alan Perlis, something like the syntax leads to cancer of the semi-colon or something.

Adam: Nice.

Hal: Point is terrific how Alan Perlis quotes.

Adam: So you think that syntax is?

Hal: Well, it’s sometimes great. And of course now these days you have many more interactive editors when you start typing something and it’ll fill in a syntactically correct expression. That stuff wasn’t around when we did it, but even so the idea that there’s really uniform syntax helps a tremendous amount in sort of getting rid the weeds when you’re trying to think of that program. Even so Lisp and Scheme have their glitches too. Even McCarthy sort of said the way they do conditional expressions conned with this double parentheses stuff. And I think even McCarthy said that was a mistake.

Adam: I mean, it seems to me that it’s very important to this book. I find syntax helps with scanning. It’s easier to read things that have a more dense syntax.

Hal: Right. And then there are variations of Scheme which use square brackets and some things. So you distinguish between parentheses and square brackets. And I don’t know, it’s a trade off. I used to standard Scheme with just parentheses myself. Don’t use any aids more than parentheses balancing. But I can see lots of people, especially those who are raised in the other extreme. Especially when you have these interactive editors that fill in things, I can sort of see that role. But again, there’s the other piece of it is what’s it like for you as the language you’re going to implement a new language? How much do you have to worry about the syntax of expressions in your implementation, right? As opposed to the real semantics of what you’re trying to implement.

Adam: Yeah. The language perspective is interesting and you’re not taking it lightly because the book actually goes through building an interpreter and then a compiler and then.

Hal: There’ve been real compilers that have started with what’s in that book.

Adam: And then I think even a virtual machine, right. I only skimmed that far.

Hal: Yeah right. That’s when you sort of really want to make some. I think it’s really good when we have students in the class, they can actually run this stuff, right? So the virtual machine, sort of goes down into the bottom of the stack.

Adam: It’s interesting because I’m thinking, you said this was being taught to electrical engineers. And I would expect that class would approach at things the opposite manner, right? Starting with circuits.

Hal: Yeah. Well. In the very beginning days, we would teach a sort of short courses for MIT faculty and some of the electrical engineers would just get stuck. You haven’t showed us how the transistors work. There’s less of that now, but still some. And people think different ways. Some people have to be grounded on where they’re comfortable and for some people, well, it really is transistors.

Adam: They’re mapping in their heads, somehow the computer program down to that level. And if you haven’t presented that mapping-

Hal: Or they don’t feel comfortable starting on the very high abstraction level. Whereas I think for most computer scientists these days that’s sort of how we work.

Adam: Well, the stack is too big for my head, the amount of things, right?

Hal: Yeah. Well, that’s what we say, right? Again, we’re sort of in the world where we really think in terms of abstraction, so we’re perfectly comfortable with a stack like that. And we say, “Gosh, we only look at a certain level and below that, well, somebody made it working that way.”

Adam: So do you think that we need to learn all these levels? Should we learn C? Should we learn assembly?

Hal: Well, again, it sort of should. The question is what’s it for? I mean, there’s certainly places where you really need people who know exactly how the bits are massaged. Mostly for real optimization and getting speed. There’s a real place for that stuff too. But I wouldn’t worry about that in sort of, in MIT you kind of hit that maybe in a couple of specialized courses for juniors or seniors. But I certainly wouldn’t start with that. But you got to remember, I don’t even know if it’s still true.

There were these computer books, there still are, in high school where you start talking about bits, so I would never do that. But certainly I know there’ve been places that did that. I think they still exist, gets a little bit harder because the stuff we’re dealing with is so much more complex, but I think there’s still people who have that philosophy.

Adam: They start bottom up with here’s how we-

Hal: We’re bottom up. Lower than that. I mean, gosh, its hey, I’m going to start doing computing. Well, the first thing I got to understand is binary arithmetic. I mean, I know there were things like that. I don’t know if they’re still there.

Adam: Yeah. There’s this great book Code that I have somewhere and it starts with flashlights and wires and builds up to a computer. It’s super interesting.

Hal: Right, that’s a fun thing. But I’m saying, the kind of details about how numbers are represented in terms of bits. I don’t think you need to encounter that very early on in the way in thinking about computing. Although at some point it’s important.

MIT AI Lab

Adam: I think you mentioned MIT AI research is that where this perspective that this book was putting down came from.

Hal: Yeah. I mean, both Jerry and I were in the AI lab when we wrote that. So of course that was doing programming in Lisp. That was really taking us through the philosophical approach to what computing was about. So it was the only natural thing for us to do.

Adam: And the book, was it well received when the book came out?

Hal: Yeah, well, it was well received. I don’t know, partly because it was MIT or something. But the thing I remember when MIT press, when we first sent it to MIT press for review, the first review came back and said, “The question is whether this will advance computer science or set it back.” I kept that ever since. Point of views that I really love. And it went on to complain that we didn’t talk about the details of how you implement linear arrays.

Prolog

Adam: You also build something like Prolog in the book.

Hal: Yeah. Right. So when that book came out, remember we were talking about programming paradigms, right? Because we were saying, “Gee there’s sequential stuff. There’s functional stuff.” Although, we didn’t use that. That language wasn’t totally there consistently when we did it. But imperatives, sequential stuff, there was functional stuff. And in those days, the big thing like that was logic programming. And of course Prolog was being really big then. And coming out as an alternate paradigm for how you think about computing. So we said, “Gee, from that, from that perspective, we really ought to talk something like Prolog.”

Because again, at the level of abstraction, it was sort of abstracting away, the sequential order in which you said things. And in the vision of Prolog, you basically were saying, “Gee, what the answer should be.” And then you sort of leave it to the guts of the language interpreter to kind of get there. Now that’s sort of bouncing around. It’s not nearly as big a piece of computing as it was in 1980, 1981. So I’m not sure that if we were to do a book again, we would do something like implementing Prolog. But it might be, because it’s, again, it’s a very important idea.

Adam: I remember when I took a course that toured through different paradigms. And the Prolog one, I think it kind of broke my brain a little bit.

Hal: Yeah, right.

Adam: It’s a very different model, but has it not succeeded. If you’re thinking of you would drop it, does that mean it’s been the less successful approach?

Hal: Well, that’s what I think. Although I haven’t been following it that much, but it’s not nearly as big an approach as it was when it was first introduced.

Adam: Yeah. It really abstracts away how things get executed.

Hal: Yeah. I mean, that’s exactly, again, that in the big picture of abstraction, that’s one of the things that you abstract away.

Forget about Types

Adam: Yeah. When you were talking about abstraction, one thing you talked about was kind of abstracting over types. Being able to add things regardless of-

Hal: Right.

Adam: So do you think that dynamic types are important to this book?

Hal: Well, it’s not like they’re important. We just take them for granted. How else would you expect anything else to work?

Adam: How else do you expect anything else to work?

Hal: I don’t know. I’ve got a variable called X. X is, I don’t know, the height of the room. I really have to specify whether I’m saying it’s fixed point in inches or it’s a floating point thing or if it’s even a symbolic thing. I mean, why as I’m thinking about designing the program do I want to think about the particular mapping of the X onto some set of types?

Adam: So dynamic types are natural and static types are not?

Hal: I don’t even understand why you’d want static types if I get facetious. But I certainly do understand that from a programming point of view and even from a program design point of view. But why do I want to worry about that right now as I’m designing a program? Why do I really want to be thinking about the data types of my variables, at least at that level? Although I do understand when you get into much more of object oriented stuff that having types and classes is another important idea of things to do. I just wouldn’t start there. And I certainly wouldn’t burden people writing their very first programs with that stuff.

Adam: Yeah. Interesting. Because there is people who believe that defining types is a way to express abstraction.

Hal: Absolutely. It’s a very important organizational idea, except I don’t think that’s types like that or whether it’s six point or floating point or string or something like that. I thought I said I think at higher levels, when you really are thinking about object oriented stuff in classes, having that type discipline can be very important. Both for designing stuff and debugging. It’s just I wouldn’t start there. If you want to tell me, why in the world should I care about the difference between a fixed point number and floating point number? Or maybe if I’m doing numerical analysis that’s interesting but I can’t see when you’re starting to program that way.

Scheme Culture and Javascript

Adam: Yeah. Interesting. I get where you’re coming from. Do you think that this kind of Scheme/Lisp culture has been lost?

Hal: Well, I don’t think it has been lost. I mean, look at JavaScript, depending on your view of JavaScript, you’re saying, “Boy it’s wonderful you don’t have to worry about it.” Or you can say, “Gosh, what a horrible thing.” If people would always make these errors and these errors with type violations. So you’re kind of seeing it right there, but again, if I’m starting out even with college students not to mention high school students, I don’t want them thinking about that stuff.

Adam: Yeah, no, that makes sense. So JavaScript is the inheritor of the Scheme flame.

Hal: Pretty much, as I said, it’s got Syntax disease.

Adam: Well, it’s gotta be the most popular language right now, right? Everybody has an interpreter for a JavaScript on every device that they have.

Hal: Sometimes in the browser.

Adam: Yeah.

Hal: Right. So in terms of education the fights between JavaScript and Python, they’re duking it out right now. I don’t want to predict how that will come out or maybe some third thing will come out.

Adam: Oh really? So that’s a contentious whether we should teach in Python or JavaScript.

Hal: Yeah. I mean, I think if you’re looking at high schools and even introductory college courses, they’re all sort of stuck in Java at the moment. And they’re moving to, I’d say more to Python right now. And that’s because Python is just wonderfully interpretively. If you’re teaching, it’s just super important that you have some interface where you basically have a command line interpreter that’s an interpreter. So Python has a tremendous advantage there. And then Python has these magic import statements. It’s just like magic.

You want a whole bunch of capabilities, you find some library and you say import and it works that way. That was one of the ways we blew it in Scheme, we didn’t pay enough attention to import. You can do it. You have to tie two hands behind your back so you can do that effective. Whereas in Python, that’s really natural and it’s a tremendous source of power. At the same time, JavaScript is now, as you say, built into every browser.

And there’s a much more fluid relation between what you write in your JavaScript program and what you actually see on your browser page. So kind of what I think is happening is you’re seeing JavaScript sort of takeover more and more of that educational territory from Python. But there’s a lot of great Python work being done in libraries there. So I don’t think that fight is anywhere near over.

Adam: It seems with JavaScript, if you could just have a browser extension so that you can modify the web as you use it, right? If I could have a little thing-

Hal: That’s what’s sort of important, if you think about, you’re trying to introduce kids and in general people to real power. With JavaScript, it’s kind of in your face that the power you’re introducing them to is the power of the web. So that’s a giant advantage that’s happening there.

Adam: Yeah. When I started doing computer programming, it was to build cool things. I guess now the more theoretical things sometimes excite me, but I don’t think they would have when I was just trying to print things-

Hal: Right. When you know there’s this whole information internet world out there and the fact that you can sort of touch it, modify it a little bit and shape it a little bit to what you think is important. That’s enormously heady and it’s enormously important from an educational perspective.

Adam: So do you think it’s easier these days to teach people about computer programming because everybody has computers and so on.

Hal: Oh, way easier. I mean, just look at the kind of stuff that people are doing.

Adam: So do people come to MIT with a lot more experience already.

Hal: Yeah. They do. Although remember MIT is the extreme end of that spectrum. So I don’t know that 10 years ago we had a lot of students coming in whose background was having started software companies. Whereas we have several of them right now. And it’s all natural that they had done programming and they’ve done programming with stuff on the web and they know 100s of packages and stuff. That didn’t happen. Certainly not before the last decade, although there were maybe one or two who were extraordinary but now it’s kind of common.

Adam: Is that represent a challenge? I guess this book’s no longer being taught, but if somebody already knows to program in a bunch of languages and then you’re like, here’s Scheme, does that influence their uptake of things?

Hal: Well, I mean, we taught Scheme up until, was it five, six years ago? So it wasn’t like it was originally. Hearing these magical things that you couldn’t do. I mean, Jerry Sussman, I should say, is just is teaching a course in advanced symbolic computing at MIT. He and Chris Hanson who was kind of the head guru of implementing Scheme. And they’ve been doing a course that really pushes abstraction and modularity and has to do with what I was saying before that how you really think about you designing a new language.

And really the idea of that book is how do you program in a way that you maintain tremendous flexibility to change what your program is doing. And looking at some pretty advanced stuff that, it’s still on Scheme. But one of the key ideas in there is that you program things in terms of combinators. It’s the way you glue code together and they have various combinator languages that do that. So they’re still working on that. They’ve been teaching it for about two semesters now. And I think that book is going to come out, I think they’re going to give the manuscript to press sometime this fall. So that means it’ll be out in about a year.

Adam: Okay. So is it in some ways book two in this?

Hal: Well, yes I mean, it’s like book two in that it really pushes this notion of a linguistic theory of design and linguistic abstraction. Although, it starts at a much higher level than that.

Adam: Wow. Very cool.

Hal: That’s a book that people should look at for. Because basically the axe it’s grinding is that gosh, people think about writing programs and software as designing a program to do one particular thing. And then the price of that is that a whole lot of software engineering ends up being trying to dig yourself a hole. Trying to get out of the hole you dug yourself into because you made a program that was too specific. So that book is really how do you not dig yourself into these holes? And the answer is you use various kinds of programming styles and techniques like combinators to glue things together.

Adam: That’s interesting. Yeah. I remember somebody in the Haskell world saying, “The way you solve a solution is you should build a library for that class of problems.”

Hal: Right. So that’s exactly the same thing I was saying before except you just said it I think more clearly and better.

Adam: There’s the xmonad windowing system. And I think that the configuration script for it is actually just you just write a program using their library that knows how to do windowing stuff.

Hal: That’s right. And those are all good examples of that.

Adam: I don’t think I’ve gotten to the level where I know how to do this effectively. It seems like that’s a thing I could do the second time around. The first time I solve something, I solve a specific solution. And then maybe if I-

Hal: Right, and you sort of have to get enough practice. So you approach it that way the first time around, although it’s hard.

Adam: Yeah. I mean, I don’t have the skill. It sounds like an amazing skill. Maybe something for us all to learn from that book.

Hal: Yeah. Well, I think what that book is trying to do is kind of to introduce the paradigms and the constructs and the examples that people would then start using. But we’ll see. It’s just, as I said, right now there are only a few people who’ve even seen the manuscript for it. They did a bunch of revisions, gosh, three weeks ago and they’re updating the manuscript and they want to give it to MIT press in the fall.

Math Heavy Book

Adam: So the students are kind of the test run for the book? I noticed with this book, I mean, you talked about it a little bit and I think this book came out of the same kind of process, right?

Hal: Oh yes.

Adam: I would say that it is math heavy.

Hal: Oh, it’s math heavy. It’s very math heavy. That’s because when we did that, we were doing it for the MIT freshmen class. Everyone in that class was taking calculus for example. So the fact that we would do an example and what do you know, our third example, whatever is, has to do with derivatives or functions. Well, that was natural for those students. But certainly not for a different audience. So we would’ve done something totally different.

Adam: Yeah. That gives us some context. Because yeah, I was wondering, we’re doing derivatives already?

Hal: Yeah, right. Well, there’ve been examples. Somebody did a version for MIT sort of humanities faculty. Where instead of those examples, they did examples having to do with text manipulation and stuff like that. In the same kind of infraction, just a different set of examples.

Adam: Math is just a domain that you can use to solve. You can use these-

Hal: Yeah. And then it was natural for us because everybody knew math and we were thinking about functions anyway.

Adam: You mentioned earlier about magic, right? And there’s a wizard on the front.

Hal: Oh yeah. That’s one of the paradigms about programming is like magic. I don’t know whether it still seems as magical, it’s certainly seemed magical in 1980 and before. I don’t know if people still think it’s magical.

Adam: What makes it magical?

Hal: Well, the fact that you sit down and you write these words. And these words are spells and they do stuff and you get these spells right. And God, something happens in this computer. At some point we talked about conjuring, the spirit of the computer. We actually got some complaints from a couple of MIT students saying, “These guys in this MIT course are talking about witchcraft.”

Adam: That’s funny. I don’t think you’d get that complaint today. But maybe the era computers were more novel.

Hal: So that’s the issue. I mean, now it’s mundane.

Adam: Yeah. I guess in some ways, if you’re doing something that’s magical and with computers that nobody has seen before, that’s something that’s lost these days?

Hal: Oh yeah. Well, that’s going to continue, right? I mean I suppose you said, think of yourself five years ago. Somebody said, “Well, it’s going to be pretty natural that you can put this little box in your house that you talk to it and it talks back and can tell you anything you want to know pretty much.” Five years ago, you would just said, “Gosh, what are you talking about? Maybe in 20 years.” And now, everybody in the world’s got got Alexa and Google Home or something and it doesn’t even seem out of the ordinary.

Adam: Yeah. And then raises the bar on a cool project that somebody can do, right?

Hal: Although at the same time you’re raising the bar, you’re raising the tools that are available. So gosh, let’s write a program, let’s write a little system, which I do for fifth graders where they talk into their phone and say something and the phone says it back in German.

Adam: So how do they do that? They’re using some trans-

Hal: That’s because you’ve got these services on the line. You basically, gosh, I don’t know. You have a thing where you talk into the phone, there’s a service that translates that into text. There’s a service where you send the English text and it sends you back German or Chinese or Spanish or any of the 140 languages. And then you take that and you put it through something that pronounces the text.

Adam: It’s cool. So in the world of this book, you use a very small language and then implement the entirety of the language.

Hal: That’s right. Because what you have is, you basically are looking at a different level of abstraction. So to say, take this speech and render it into text is one operation. And you can think of it as one operation. So even though the bar becomes higher, the possibilities are also also become a lot higher.

Building with APIs

Adam: It’s funny because in a way you were saying, “Okay, I put out this book and people were like, what? You didn’t even say the difference between arrays and lists.” And now the abstraction level is way above that. And people are like, what, we didn’t even glue together APIs to remote machine learning services.

Hal: Exactly. But I think that’s why from a very high level point of view, this notion of abstraction remains. It’s just that now you can kind of abstract at a much higher level. But the notion, what’s the right way to say, that you can deal with things of which you don’t have to worry about the implementation details. It’s just the critical thing,

Adam: Because it focuses on the language of the solution. So the levels don’t matter so much, right?

Hal: So it focuses on, you basically can work at a particular level and do whatever it is you want to do. And you don’t have to dig down below that necessarily. No, of course, sometimes you have to. If you’re using the translation service and the network goes down, you have to think about what’s happening there. The other thing is collaboration. I mean, let’s put up a program that lets you put up, you walk around town and you mark things on a geographic map. And that map is shared and accessible by anybody in the country.

Adam: Yeah.

Hal: And I said, “Gee, five years ago you’re going to do that.” You would have said, “Oh my God, that’s incredible, that’s insane. I couldn’t possibly do that.” And now everybody can just stick things on a map.

It’s a Consumption Culture

Adam: Yeah, that’s true. So I have this perspective that maybe because computers are phones now and you them to look at Facebook or Instagram or whatever. But when I was a kid, the Commodore 64, started up and it was a basic prompt. I don’t know. Things are biased towards consumption I guess.

Hal: Oh, that’s certainly true. On the other hand, you also can do things for production. It’s not nearly as common. But again, even with computers now kids program them, kids can do some stuff. And again, they can do amazing things. Of course there are many more kids and people who just sit there and look at Facebook. But we can argue about whether that’s good or bad or something. But there’s still the possibility of actually building really good things with those tools.

Adam: Yeah, the trade-off. Just the power they have is so much more, but they may not do anything.

Hal: Could be. It depends.

Adam: You had this thing, something called App inventor.

Hal: Yeah. That’s the kind of what I’m sort of back in referring to. That’s what I’ve been working on in MIT for the past few years that I started when I was visiting a Google. So the idea of the App Inventor is that any kid ought to be able to build mobile apps. So we have this sort of a drag and drop blocks programming interface that allow you to put procedures together for the phone and then run them on the phone. The example I said about making a map that everybody in the world can share. Those are actual app inventor projects that are done by junior high school kids and high school kids.

But it’s because you’ve got access to all of those services. That’s one of the tremendous differences that’s happened that there really are these things on the web that people can go and grab it. And of course the next round, which is even starting to be here is the same kids will be able to use conversational interfaces. So again, if I said four years ago, you would have started well yeah maybe, and now every kid you know has played around with Alexa. So the idea that kids could build some stuff that can make Alexa do something doesn’t seem nearly so far fetched.

Adam: Yeah, like my nephew.

Hal: That’s one of the things we’re working on in App Inventor.

Adam: Has it led to people pursuing computer programming?

Hal: Well, App Inventor has only been around for, I mean, we started this as a research project in 2008 and there’ve been a lot of kids doing App Inventor no Scratch is the other one that’s even bigger coming out of MIT. So there are many kids who’ve gotten their exposure to computers through Scratch and App Inventor. But to do another piece of research and to say, “Okay, well, what fraction of those kids have gone out to actually do something in computers professionally, or when they grew up or something like that?” I don’t think enough of that research has been done. Because what’s so hard is that computers are so incredibly more pervasive now. But that’s an important piece of work that needs to be done.

Adam: Why does their pervasiveness affect it?

Hal: Well, what’s your test group going to be?

Adam: That’s a good point. Yeah. I was just thinking anecdotally has it been a success?

Hal: Oh, there’s been lots of anecdotal stuff. But the other issue is the scale is getting so much bigger. As I was saying for our App Inventor thing, we run off a server at MIT. We have a million active users a month.

Adam: Oh wow.

Hal: Nothing anybody would have dreamed of 10 years ago.

Encouraging Diversity in Engineering

Adam: Yeah. That’s impressive. That’s great. Do you feel this will encourage more diversity in the field?

Hal: Well, I sure hope so. Because I think that’s a really critical issue and it’s critical both in terms of how computing affects society. And it’s also even critical for the commercial interests of the companies doing this stuff? So I don’t know, what’s the analogy. I still consult at Google and certainly one of the issues we saw in Google is the diversity of people they actually have designing these products. Because at the end of the day, if you don’t actually have a diverse design team, you’re not really creating products. You’re just ignoring a whole percentage of the population when you think about making computational tools for people.

And there’s nothing new, it wasn’t until I don’t know the date, but not a very long time ago that in automobile crashes, there was a much higher percentage of female fatalities. Just the fact that women would end up really worsen and on appeal crashes. And it turned out that one of the reasons for that is the national safety standards didn’t mandate that the companies use female physique crash demos.

Adam: They weren’t even testing that case.

Hal: And so when they tested it, they weren’t even doing it. And the result was, actually when cars got out, there are higher levels of fatalities until very recently. But that’s a really extreme concrete example of there was a whole part of the population in this case, women that these engineering artifacts were not designed for.

Adam: Yeah. There’s also just, if you have a group, groups can make better decisions than individuals, but only if the group represents people with different backgrounds.

Hal: Exactly right. So what’s happening is a lot of the companies, like Facebook and Google and Amazon and everywhere are getting slammed for this. And they’re starting to realize it, but again, it’s just starting. So, you point that out as an issue, that’s just a major issue that we have to address.

Adam: It’ll take time, right? You’re on there. MIT I assume is not a 50-50 male, female.

Hal: I mean historically what’s happened. If you look in computing, the percentage of women is half of what you expect. It would be. So, at MIT, gosh, let’s say it should have 50% men and women, but only 25% of the computing students will be female.

Adam: Oh, I see.

Hal: So whatever it is, it’s about half of what you’d expect. And that seems to be pretty common, but it’s a really serious issue that everybody needs to work on. And Google sees that and they’re recruiting, everybody talks about a pipeline problem.

Adam: Yeah.

Hal: And at the same time as computing products become more and more things that everyone uses commercially, it becomes economically important for these companies to appeal to as large a segment of the population as possible.

Adam: You mean they’ll build better products if they’re more representative?

Hal: Yeah. They’ll build better products where, I mean, you can be totally mercenary. Better products could mean they’re better tailored to more of the population so they sell more of them.

Adam: Yeah.

Hal: Whatever your definition of better are. But even from the most mercenary point of it, you want to have that kind of diversity.

Adam: In machine learning, they have bagging, they take several learning algorithms and put them together and then you get a better result. If you have diverse backgrounds and you combine them.

Hal: You probably know the Amazon hiring example, which is just a fiasco.

Adam: No.

Hal: Oh Amazon last year, two years ago, basically did a machine learning thing to help evaluate resumes of who they would hire. And it turned out that if you had a resume that mentioned that you did something as a woman, the programs scored you lower, all you had to do was include stuff about women, even with everything else the same and the programs scored you lower. So it turned out that when Amazon looked into this, what was happening, they were training the data on the CVs of their Amazon employees. Which of course had very few women.

Adam: Yeah.

Hal: So what happens the standard thing that goes on now, when you build these machine learning things. Or until very recently, you trying to train them on the data that’s there. And the data that’s there is biased. So what happens is that your machine learning program just perpetuates the bias.

Adam: Yeah. I had Cory Doctorow on as a guest and he was talking about in Oakland, they did some sort of machine learning on arrest data. And basically it just learned the bias that was present in the existing system.

Hal: Right. All that predictive policing. And that one’s really easy to understand. Because what happens is, if you want to get more arrests, you just assign more police to a place, right? So even if the crime rate’s the same, you’ll get more arrest if they’re more police. So it happens that sets up this positive feedback loop where this machine says, assign more police to this place. Guess what? They’re more arrests. Guess what? You should assign more police there. So that one’s actually pretty easy to understand.

Adam: Second order.

Hal: But there are ones that are just way more subtle than that, right? Having to do with the ages of people and just lots stuff. It’s a hard issue. The companies are really trying, but they stumble over this stuff because they train on the data that’s there and the data that’s there is often biased for historical reasons.

Adam: Yeah.

Hal: And then you have your system that perpetuates the bias.

Open Culture and Naivety of Early Internet

Adam: So I’d like to ask you about something else. I was watching this video. I think it was an interview you did for MIT. And you were talking about the early days of the MIT AI lab and talking about some of the culture. And one thing surprised me, which was that you guys didn’t have computer passwords. Everything was kind of open.

Hal: Sure. Well, come on there. There’s the standard thing that everybody realizes now that everyone will say. The internet actually before the internet, the ARPANET and all that stuff was made for a bunch of nerds like us, right? So nerds like us or people like us, we’re not going to try and do anything to subvert the system. We all are fairly intelligent to get how the system works and we’re all have a shared goal to make it better. So why in the world would, I want to try and protect against people like that? So the fact that there were no passwords, it’s just an example of that.

I mean, why would I need anyone to have a password? No one’s going to do anything bad. So one of the real shocks that’s finally gotten into even the computer networking and computer science communities, guess what? There are bad people out there. And quite literally, nobody actually thought that you had to design the network against bad people. And there’s some fundamental flaws in the way the Internet’s put together that come from that initial sort of naivete. Of which the biggest one is no verification on DNS, right?

So, when I connect to a website and say, “Hi, my address is 18.43.0.79.” The thing I’m connecting to believe me. Okay. And, look at all the spam, look at all the fake messages that come through, look at all the malware that comes from a forged place. I mean, that’s major vulnerability in the network right now. And it certainly because nobody thought at the beginning that if I connect to a website and I advertise my address, well sure am honest. Everyone should believe me. So we’re paying for that right now.

Adam: But is the success of the internet related to this initial openness and naivete?

Hal: You gotta be a little bit careful. I mean, you can say that, certainly made things easier. But there’s a difference between openness and verification. If I send you a piece of email, you can certainly design your system so that anybody can send you an email. But at the same time that doesn’t contradict that whoever’s sending you email has to verify that they’re really coming from the address that they’re saying. Of course, what I just said is kind of controversial because that doesn’t really allow anonymous email.

But the fact that you’re putting prohibitions on something and authenticating, those aren’t necessarily incompatible. And as I said, the danger one is DNS security where there’s just no, hey, I connect to you. And the site that’s getting the connection believes who the connections coming from. It could still let anybody connect, but it might want to verify that that’s really the address that’s coming.

Adam: It’s interesting that you’re pointing out problems with security be caused by this openness. Because I was thinking that you would be very for the culture of initial openness.

Hal: Well, but again, don’t confuse openness with the fact that you can verify what people are doing. I mean, certainly it’s way advantageous in the network to let anyone connect to some site. That’s really critical but that’s different from saying when I connect to a site, the side you’re connecting to can verify that that’s really the address that you’re advertising.

Adam: Yeah. That makes sense.

Hal: Hey, look what’s going on right now with spam phone calls, right? Anybody can call you and that’s okay. Or maybe not. On the other hand, these days people are forging the number they’re calling from. That’s not okay.

Adam: Yeah. I guess that’s the same problem. I never thought of that. Yeah. They can spoof the callback or whatever.

Hal: Yeah. So it’s a real pain in the neck. So now they’re talking about putting in these protocols so they can spoof them as much. But again, there’s a difference between spoofing your address and whether or not you’re allowed to make a call in the first place.

Adam: Yeah. On the topic of openness, you co-founded the Free Software Foundation?

The Free Software Foundation and The Creative Commons

Hal: Yeah. Co-founded the Free Software Foundation. I also co-founded Creative Commons much later. So the Free Software Foundation was what, 1985. Creative Commons was I think 1999. But they come out of the same idea.

Adam: That idea being to encourage an open culture on the internet or what?

Hal: I mean, the Free Software Foundation is trying to say that dealing with software is kind of a human right. So if there’s a program, anybody should be able to use it. Anybody should be able to modify it and anybody should be able to redistribute it. Because it was saying in those days of software, and even now you want to view these computer programs as a resource of civilization, that’s really the philosophy behind it. That’s really what’s behind the GPL, the general purpose license. Is saying you ought to have those rights and then if people restrict those rights, various bad things can happen. Like gosh, if no one can look at the source of your program, how do you know there’s not malware there.

Adam: That’s true. But there’s lots of software that’s not GPL. If it’s they’re running, that doesn’t have malware in it.

Hal: Oh, sure. Yeah, of course. But the point is you’re sort of beholden to the people who can see the source of the code or own it or put proprietary restrictions on it. But certainly what you’re saying is true. Because it works at all, but there’s a lot of security that would help if the sources of programs were around for everyone to examine. It’s not magic, right? Because the big contradiction to that of course was Hartley, which was crowned in source for a long time nobody noticed it.

Adam: Yeah, that’s right. There’s not enough eyes in the world. It seems to.

Hal: Yeah. That’s right.

Adam: Yeah. Did you expect to the Free Software Foundation and the GPL to be as successful as it has been?

Hal: I don’t think so. It was so hard to look back. Because now we’re talking about millions and millions of people using stuff. And when this stuff was made it was, Oh cool. We might get a 1000 people to use this and wouldn’t that be great. So it’s so off scale that it’s hard to say what’s expected. When we started Creative Commons, even in 1999, we’re saying, “Well, what would be great success for the Creative Commons license?”

Oh, well, if got a million people to license this stuff with Creative Commons, wouldn’t it be marvelous? And now we’re in whatever it is, one and half billion or something. So there’s a whole scale that’s grown together with access to the internet. That makes it very hard to answer the question, did you predict it would be this successful?

Adam: Yeah, it certainly has been successful. Now Google is running lots of GPL code, but because they offer Cloud Services, their code will never be accessible.

Hal: Google doesn’t use GPL so much anymore, right? Google tends to release it’s stuff under Apache, although there is a tremendous amount of GPL stuff going. What you won’t see Google use is AGPL because that’s the stuff they hang on their server that has all the secret sauce.

Adam: Yeah. Because it seems the new Cloud hosted companies, whether something is GPL or not is less important.

Hal: Yeah. Right. That’s right. Well that’s why AGPL is there. And that’s also what you don’t see the Cloud hosting companies use it.

Adam: Yeah. So it’s like you won but-

Hal: Well, based on where it started, the idea that there would be lots of places, lots of commercial companies using this stuff, it would have been really super. Was it Microsoft who at one point back then said did GPL is like communism?

Adam: Or cancer or something. Yeah.

Hal: Maybe it was cancer something like that.

Adam: Yeah.

Hal: Now you see Microsoft putting out all sorts of GPL stuff. So, there’s a long way to go, but don’t say that nothing’s happened.

Adam: Oh, I’m not saying that. Yeah. I just feel the context has changed because a lot of software isn’t running on my personal machine.

Hal: Right. And the GPL is really from the world where the software is running on your personal machine and you in fact are in control of it. Whereas, the big difference now is that stuff has gotten so complex it’s not reasonable mostly to say that you’re in control of the stuff that you’re using. And yet somehow you still have to think about how you preserve those fundamental rights in this new environment.

Adam: Yeah. And how do you? It’s open question.

Hal: I don’t know. I think that’s a real challenge.

Adam: And then if you build something open source, if you build an open source database or something Amazon will probably make money running it on its servers.

Hal: Oh sure. I mean, that’s the other sort of societal issue. Which is, it’s the places like Google and Amazon and Facebook because they control so much data. Forget about the software and all, that they were in a much better position to get advantage from the software being out there. So that’s a whole thing that people haven’t confronted yet that you sort of say, “Well, we put out the software, the software’s free, software is doing all this stuff.”

At the end of the day, that does not lead to a more equitable society because these places that already have control of the data are really the places that are making the most profit over it even though everyone has the software. So, that’s a really serious issue. I don’t quite know what you do about that. And I don’t know that people have really confronted it. But it’s a real phenomenon.

Adam: Yeah. You could say, “Technology empowers all.” But that’s not true if it’s machine learning and you don’t have the terabytes of data to get a useful result out of it.

Hal: Yeah so I think people are going to be noticing that more and more, but I don’t know that they’re quite the ideas there yet.

What Would You Change in the Book?

Adam: So I wanted to kind of wrap up by asking you about the book. So you mentioned if you rewrote it, you might drop Prolog. The book’s been out for a long time, what would you change if you were doing it today?

Hal: Oh, we did not do nearly enough on object oriented stuff. So when we were doing it, we did a little bit of it, how you define objects? We did pretty primitively how you’d write procedures to build new objects. So let me say it a different way as I think about it. When we talked about objects, we said, “Gee, what’s really important is that this object is encapsulating local state.”

So if you look in my chapter three of the book, that’s the whole message. It’s a great thing that you can encapsulate local state. We didn’t at all talk about abstractions like classes and how you organize different kind of objects into classes and what that whole thing would be like. That’s become tremendously important and we just didn’t appreciate that at all.

Adam: It’s interesting because I feel the book is popular with people who are kind of functional programmers, who would reject your idea that objects are important maybe.

Hal: I know that what with the Tesco with the state monad and all that stuff. Well, that book probably did more functional programming than any other book that came out at that time. So we pushed functional programming a lot, but we certainly didn’t take the idea that you should always use only functional programming.

Adam: Yeah. That makes sense.

Hal: Partly because we didn’t know how right. I mean the Pascal folks has done a way better job with that than we have.

Adam: I mean, I think there’s still some things that are awkward to do in a functional.

Hal: Well, we didn’t even think about that. We said, “Gosh, a natural thing you want to have to do is do it with Scheme.” But anyway, I think we didn’t really talk a bit how you use classes and how you think about subclasses and superclasses and how you organize that way. And then of course, another thing that we didn’t do is we didn’t think of that interactivity at all.

Adam: So do you mean interactivity in terms of an IDE or a repo or-

Hal: Yeah, absolutely. I want to process a mouse click for God’s sake.

Adam: Oh yeah.

Hal: Not to mention all this stuff you’re talking about.

Adam: Yeah

Hal: But we didn’t even think about those kinds of programs at all.

Adam: It’s interesting because, so it has some stuff on streams.

Hal: But our streams are very functional.

Adam: But some people deal with interactivity now by actually, oh, here’s a stream and events will come in.

Hal: Yeah. We talked about that and we talked about, yes, you can organize the program that way, but I’m not sure. I don’t know I’ve never tried doing a mass handler that way, although I assume you can.

Adam: Yeah, I think it’s possible. But yeah. So I guess another perspective is, you wrote this book in 1985 and you were kind of introducing this different way to think about computing. So if you were writing a book today about computer programming, that was going to be a new way to think about computing. What would be in it?

Hal: Our book was kind of self-contained in the sense of it’s about the programming stuff. But certainly if I’m doing education now it’s much more about what’s the environment that you can program in? How would you talk about the web? How would you talk about getting other services? These days what’s one of the most important concepts that you’d want students to know about? And the answer is, it’s an API, it’s the idea of an API. I mean, you can say that that’s abstraction too, but I’d certainly want to talk about the possibilities of what you can do with programming.

Adam: Would it even be a book then? Or would it be your app building tool or.

Hal: There are other things to platform and it’s mostly for younger kids, but certainly if I were writing a book, I would talk about that. And as I said, in some sense, Python really is the one that did that not exactly right in terms of APIs. But in terms of import and say, “It’s not only you writing this program by yourself, there’s this whole world of libraries that you can take advantage to.” Yeah. So Python just really did that well. And I’d try to get that sense into a book.

Adam: Yeah. Because there’s programming in the large, I guess you talked about Google, right? All kinds of things. Not just imports, but reviewing each other’s code and.

Hal: I’m not sure that I would talk about that. Certainly when you get to in a more advanced course, you do that. And certainly hanging out at Google was part of that culture too. And it’s very impressive. And Google certainly takes that extremely serious and it’s wildly important, but I don’t know that’d be in an introductory course.

Adam: Well, this has been a lot of fun, Hal. Thank you so much for your time.

Hal: Okay. Well. You got more questions? Just let me know.

Adam: Max, thank you so much for requesting I talk to Hal. Everyone else, if you have recommendations, let me know. You can hit me up on Slack. There is a suggestion form on the website in the top or just shoot me an email or leave a comment. I love to get suggestions about guests. If you listen to this far I hope you enjoyed the interview. Until next time. Thank you so much for listening.

Join the Newsletter

Did you know CoRecursive has a newsletter?

Sign up to get insights, takeaways, and exclusive content from each new episode.

    We won't send you spam. Unsubscribe at any time.
    Audio Player
    back 15
    forward 60s
    00:00
    00:00
    56:00

    Language Oriented Design