Home Gotopia Articles How to Discover ...

How to Discover the Binary System as a Child

Why do we still need to teach kids programming when AI can write code instantly? Haskell creator Simon Peyton Jones explains why computational thinking is like numeracy - essential for digital agency, regardless of the tools available.

Share on:
linkedin facebook
Copied!

About the experts

Chelsea  Troy

Chelsea Troy ( interviewer )

Read further

The Binary System Discovery: A Teaching Moment

Chelsea Troy: Hi folks. Welcome to this episode of GOTO Unscripted. My name is Chelsea Troy. I lead the machine learning operations team at Mozilla and I teach in the master's program in Computer Science at the University of Chicago. I'm here today with Simon Peyton Jones. Simon is a Royal Society member and a former computer science professor at the university level. He now works with computing at schools designing programming education for children in the UK. Maintains the Haskell programming language and works as a Computing fellow at Epic Games. Welcome and thank you for joining us, Simon.

Simon Peyton Jones: Nice to see you.

Chelsea Troy:It's great to see you. I'm excited to discuss computing, especially computing education,because it's a topic I care deeply about, but one that doesn’t get as much attention as I’d like.

So, could we start with an anecdote you shared earlier this year in your Bits with Soul talk at the Darwin College lecture series? For those interested, it’s available on YouTube and is excellent. At the beginning, you describe an exercise from about 55 years ago: You work at a bank and must quickly provide an angry customer with exact sums between 0 and 1000 each day. How did that exercise work, and what did it make you think about?

Simon Peyton Jones: Well, this was, indeed, a problem given to me by my Math teacher. He said, well, as you are the bank clerk and you have this angry customer that comes and you make a plan that would you put into the, into ten envelopes particular sums of money. And then when the customer comes and says, I want 763 pounds, you go flick, flick, flick. That's 763 pounds. The question is what's in the envelopes?

So this Bits with Soul talk was specific to a very general audience.It was everything from 11-year-olds to social workers to professors of quantum mechanics, a broad audience. We'll include a link in the show notes. This was an important moment for me because I realized, well, you need an envelope with a pound in case you're asked for one pound. Then he might ask for 2 pounds, so you could have another envelope with a pound, but why not have one with 2 pounds? Now, with the two and the one, we can make three. Then he might ask for 4 pounds, so let's have an envelope with 4 pounds. Now we can do 5 pounds with the four and the one, 6 pounds with the four and the two, 7 pounds with the four, the two, and the one. Then we need one with 8 pounds. And before you know it, you’ve invented the binary number system.

What I thought was so clever, in retrospect, was that my math teacher had forced me to invent the binary number system by giving me a problem that could only really be solved elegantly that way. Rather than saying, “Let me teach you about base-two arithmetic,” it was a real problem with a visceral sense of discovery, a moment I can still remember 55 years later.

Chelsea Troy: That's fantastic. When I heard you describe this problem, I thought, this sounds really interesting, I want to give this to my students. I teach a class in the spring called Topics in Software Making an Impact, where students learn not just how to write code, but also about the impact of their decisions in software engineering.

In talking to students, particularly independent students and a few who came to office hours, I presented this problem to them. What they often did, and I didn’t know this would happen, was say, “Okay, I need ten envelopes with 1 pound each, then ten envelopes with 10 pounds each, and then ten with 100 pounds each. Then I have my thousand.” I’d respond, “Yes, but now you have 30 envelopes.”

I haven’t yet figured out an effective way to guide students from that conclusion toward discovering the binary approach. I'm curious if you have thoughts on that.

Simon Peyton Jones: One thing I would do is say, “You only have ten envelopes.” That gives them a challenge: it can be done with ten, that’s already a clue. If they don’t know how many it takes, they might think of a thousand. My math teacher did this for me: he said, “You only have ten envelopes,” because otherwise, you could just have one for each amount.

Another helpful clue is to guide them step by step. Suppose he asks for 1 pound. Now suppose he asks for 2. One envelope isn’t enough, what would you do? Work up from the ground. This is a common pattern in computer science: start with one, then two, and look for the common pattern. From there, you get a kind of proof by induction.

Chelsea Troy: Yes.

Simon Peyton Jones: So rather than trying to solve the general problem, trying to solve multiple instances of a small problem or a small concrete problem, it's often a good way to go when you're trying to do problem solving isn't it. The general problem is too complicated.

Recommended talk: Shaping our children's education in computing" by Simon Peyton Jones

Problem-Solving in the Age of AI

Chelsea Troy: Absolutely. I’ve always believed this is an essential part of education, but it feels especially important now. With students able to use large language models to quickly find answers to the programming problems I assign, the emphasis has shifted from simply obtaining the answer to focusing on the process I want them to follow to arrive at it. This process is scalable, and when applied iteratively, it helps them tackle increasingly complex problems effectively.

Simon Peyton Jones: I think it is. LLMs are a challenge for education because you can jump straight to the answer. But it’s a challenge in a way similar to how calculators have long been a challenge for teaching math. There’s a lot of evidence that basic numeracy is an important life skill. Calculators make computations faster and more accurate, yet being innumerate is still a handicap.

I believe we still need to teach children the fundamentals of computer science, including programming, even if an LLM could write their programs instantly, just as a calculator can do nine times seven in a flash. We spend a lot of time teaching primary school children arithmetic for reasons that turn out to be educationally sound, even if counterintuitive.

Chelsea Troy: Yes.

Simon Peyton Jones: I think we have to do a bit of work as computer scientists to try to distill what is the, what is it that we are trying to actually convey. But in this process it's clearly not the ability to write a sorting algorithm anymore.

Chelsea Troy: Right.

Simon Peyton Jones: It's something about problem solving or problem decomposition that it's a bit. But the more you try to get it, the more abstract it becomes. And then I say, go back to concrete problems.

Chelsea Troy: I think it's interesting how the advent of large language models makes it so easy for students to, for example, ask for insertion sort and immediately get it, rather than going through the problem-solving process to arrive at it themselves.

A nuanced point I have is that, before LLMs, students often weren’t doing problem-solving either. They would look up an implementation of insertion sort and memorize it for their exams. Focusing on problem-solving requires either working on a less familiar problem or something more concrete. There’s something very specific about the bank, the angry man, and the envelopes that makes this an enticing problem, compared to just telling students, “You need to invent the binary system on this exam.” The story adds value to the problem-solving portion.

Simon Peyton Jones: I’ve seen this with my son when he was writing Scratch programs. He wanted to play games, like having a spaceship go toward a planet. He realized the closer the spaceship got, the slower it should move. He started thinking about the distance between the spaceship and the planet and how far the spaceship moves each step. Then, when the spaceship passed the planet, he realized he needed negative numbers.

Chelsea Troy: Right?

Simon Peyton Jones: Literally begging. “You mean we can have negative numbers?” Yes, they’re allowed. Rather than negative numbers being a strange concept you learn in math class, they became a tool to make the spaceship move correctly.

When the spaceship moved not just East-West but also North-South, he was effectively doing vector arithmetic, deciding how fast to move in the X direction and the Y direction. Nobody told him he was doing vectors, but that’s what he was instinctively doing. Again, it was driven by a very concrete problem.

Once you step back, you realize we’re working with little vectors. Eventually, the problem becomes too complex to solve intuitively, and you need a deeper understanding of mathematics. To me, this is a great way to learn Computer Science and Math, through concrete, motivated contexts.

Chelsea Troy: I would agree with that.

The Journey into Computing Education

Chelsea Troy: I’d be curious to hear if you’d share a bit more about how you went from being that student, unwittingly inventing binary mathematics because a teacher asked you to, to someone working in computer science education yourself. How did you decide to go into that field? What brought you here?

Simon Peyton Jones:I mean, it’s been a long journey. I’m really a research computer scientist. I left university, joined a company for two or three years, and discovered that working for customers is actually hard work. I ended up back at university as a lecturer at University College in Glasgow, and then I joined Microsoft Research. All this time, I was essentially a professor of computer science.

Then I had children. They went to school in the mid-2000s. Sitting around the dining room table, I asked them what they were doing in school. They told me about ICT, information and communication technology, a school subject they regarded with dismay and even contempt. I thought, this is bad. This is a subject I’ve devoted my professional life to, yet they see it as dry, boring, and undemanding.

That’s not the case in natural science. If they were learning about tadpoles in primary school, as a biologist I could recognize it as part of my discipline. But I couldn’t recognize what they were doing in ICT as part of the things I found so interesting.

That was when we started this organization, Computing at School, that it was a sort of guerrilla group of people who just thought that what we were doing about computing education in Britain, in England in particular,was not really meeting the need. But in that case, what is the problem? We had to define what we wanted. None of us were professional educationalists, some were school teachers, others, like me, worked in university computer science departments.

We realized that for Natural Science and Mathematics, every child learns the subject as a foundational discipline. At the time, ICT was treated as a vocational, instrumental discipline, you learned it because it taught useful skills. We decided to reimagine computing, not as vocational, but as foundational, like Mathematics, Physics, Chemistry, and Biology. Every child should learn it, not just those who will become professional computer scientists, but so they can understand the world around them, have agency, and make informed choices.

Similarly, computing literacy gives children agency in the digital world. They need to understand technology and the Computer Science behind it, at an elementary level appropriate to their age, just as we teach biology in primary school.

In the mid-2000s, saying that every primary school child should learn computer science like natural science was radical. To my astonishment, it became part of the national curriculum in England. Delivering it effectively in every classroom remains a huge challenge, requiring trained teachers and sufficient resources, but the vision is strong and valuable.

Chelsea Troy: I’m curious to hear what computing education looks like at the elementary school level. My experience as a child was similar to what you described for your students. I took a class called Computer Applications, but most of it involved the teacher sitting in the corner reading a book while we logged into Windows 95 computers. We spent about 40 minutes on Mavis Beacon Typing Tutor, that was most of what we did. I’m curious: if I were a child today, what kinds of things would I be learning in computing at school?

Simon Peyton Jones: I put a link in the chat to the Barefoot resources, which are specifically aimed at primary school children. What would I expect primary school children to be doing? I’d expect them to be actively creating rather than just reading books.

I think it’s helpful for them to learn to type, but that shouldn’t be the main focus. I’d love to see them programming little robots that physically move around the world. With tools like the BBC Micro:bit, Raspberry Pi, Arduinos, and Crumbles, children can engage in physical computing, making things that actually do something, programmed in an elementary way.

Writing little programs in Scratch is also central. My son loves it because he can create things that didn’t exist before and share them with others.

Alongside all this activity, it’s important that children are learning, not just engaged. The National Centre for Computing Education, launched in 2018 in this country, has built many teaching resources for children aged six to sixteen. These resources help teachers articulate what children should be learning and how the cognitive concepts fit together.

Chelsea Troy: Sure.

Recommended talk: What Counts as a Programming Language? • Chelsea Troy • YOW! 2021

Functional Programming and Compiler Design

Chelsea Troy: If I could, I’d like to change tack for a moment and connect this to the work you do maintaining Haskell. One of the things I discuss with my students is the different kinds of skills they employ when doing different types of programming. A lot of programming education, at least the education my students have had by the time they reach me, focuses mainly on end-user applications.

I teach master’s students, usually around 24 years old. They’ve taken programming classes, and they often imagine going into the world to build iOS apps, web applications, or, increasingly, applications surrounding large language models. Compiler design, however, isn’t something they’ve engaged with as deeply. Many of the things you have to optimize for in compiler design are completely foreign to them.

I’m curious how you would describe what’s magical and interesting to you about this type of computing.

Simon Peyton Jones: When I was at university, learning C, BPCL, and Fortran, I also got introduced to functional programming. Functional programming is programming without side effects. Most programming involves doing things in sequence and mutating variables. In functional programming, you program with values, not boxes containing values, and write functions over those values.

At first, I thought functional programming couldn’t be very interesting, but I learned that it’s Turing complete and, in some ways, more powerful. Functional programming felt like a radical and elegant approach to programming. I became part of a research community developing basic functional programming, which ultimately led to the Haskell programming language. Inspired by these “aha” moments, I realized that pushing purely functional programming ideas far could lead to very different, and powerful results.

Building an implementation of Haskell required building compilers. Functional programming fits compilers well. Haskell compilers are written in Haskell because compilers are like functions: they take an input, such as a syntax tree, and transform it successively into an output, a sequence of machine instructions you can feed to your x86 machine. At each stage, you don’t mutate the original source tree, just transform it from one form to another. So a compiler is quite a good fit with that programming paradigm. For a long time, Haskell didn’t have much input/output capability, certainly not on GUIs or similar. That took a while to develop, which was an interesting story in its own right.

Recommended talk: Keynote: Excel meets Lambda - Andy Gordon, Simon Peyton Jones | Lambda Days 2021

Working as a Computing Fellow at Epic Games

Chelsea Troy: I would love to hear that story sometime. I don't know if we have time in the next five minutes, but sometimes I'd love to hear it. Sounds good. I do have one more question for you, and that is about your work as a computing fellow at Epic Games. Is that right?

Simon Peyton Jones: Yes.

Chelsea Troy: Now, as a computing fellow, a title or role that my students, for example, as people about to enter the field of Computer Science, are less familiar with, they’ve heard of software engineers, engineering managers, product managers, designers, and similar roles. But as a computing fellow, I don’t know if they would consider that as a potential career path. I’m curious if you could talk a little about what it means to be a computing fellow at Epic Games?

Simon Peyton Jones: It’s a kind of unusual, one-off situation. I was 63 and looking for a job when Epic was in the midst of designing a programming language called Verse. An old friend and drinking companion of mine,Lennart Augustsson, was already working on Verse with Tim Sweeney. Epic is designing this language because its founder and CEO, Tim Sweeney, is fundamentally a computer scientist, he’s the person who first implemented the Unreal Engine and has been designing Verse in his head for the last couple of decades.

My role, essentially as an unemployed computer science professor, is to reverse engineer Verse out of Tim’s head and write it down in a way that others can understand. Tim is remarkable, with an extremely strong technical intuition. He can jump immediately to the answer, but it takes time for him, me, and others to understand why he is so convinced that a particular point in the design space is the right one. He tends to land on an interesting point, though it’s not the only possible choice.

Chelsea Troy: Okay.

Simon Peyton Jones: I wouldn’t call it a career path. I feel incredibly fortunate that, in my life, people have been willing to pay me to study things that interest me, like functional programming and computing education. Then I happened to end up in a unique situation at Epic. It’s unusual, few people have a two-hour conversation every week with the CEO of a multi-billion-dollar company. In these conversations, I might say, “Tim, this is getting very complicated,” and he replies, “Simon, it’s all fine. It’s pretty simple. You just have to think about the denotational semantics.”

Chelsea Troy: Yes, of course, the denotational semantics. How could we forget about this?

Simon Peyton Jones: Well, not many CEOs have that as their priority, right?

Chelsea Troy: It's true.

Simon Peyton Jones: Mostly they say we've got to think about our profitability, our customers or IPO. But no, it's the innovation  side. I love it, it's great.

Chelsea Troy: Oh, it sounds lovely. Well, thank you so much for taking this time today, Simon. We really appreciate it. I'm sure that folks are really going to enjoy this. Thanks again for making the time. I really appreciate it.