Future of Coding - Teaching Elm To 4th Graders: Christopher Anand
Episode Date: October 3, 2017Most people consider ML-based langauges like Elm hard enough to learn as an adult. But according to Professor Christopher Anand of McMaster University, they work really well to introduce Computer Scie...nce to children, starting in 4th grade! In this episode, Christopher and I explore the difference between alegbraic thinking and computational (or sequential) thinking, and why this is incredibly relevant today as the "coding for all" movement gains traction. You can view the notes for this episode online at http://futureofcoding.org/episodes/13-teaching-elm-to-4th-graders-christopher-anand.htmlSupport us on Patreon: https://www.patreon.com/futureofcodingSee omnystudio.com/listener for privacy information.
Transcript
Discussion (0)
Welcome to the Future of Coding. This is Steve Krause.
Today I have Professor Christopher Onnand on the podcast.
So the story about how we got connected is kind of funny.
About a year ago, I was at home during New Year's time.
The board didn't have anything to do, so I was teaching myself Elm.
And I was trying to make some games in Elm, and I found, just looking through the Elm documentation, it linked directly to the website of Professor Onland's work with McMaster University's outreach program. He teaches Elm to kids, as you'll hear about in a bit.
And so I found his tutorials on how to make games and animations in Elm, and I worked through them
myself, and they were great. And so I shot him an email, he got right back to me, we got on the
phone, and it was really fun. And it's kind of hilarious, I think, to both of us how similar
our philosophies are about teaching computer science to kids,
teaching algebraic thinking as opposed to more procedural thinking.
And you'll hear what we get into that in the podcast.
Some more background on Christopher.
He is a professor at McMaster University where he runs their outreach activities for the computer science department. Last year, he taught computer science and algebraic thinking to over 5,000 students in over 200 classrooms in Canada.
One thing about him that I think is particularly notable is that he really leverages his student
teachers and really manages them well and mentors them and gives them a lot of credit and
gives them a lot of responsibilities.
It's kind of amazing to see. When I first asked him to be on the podcast, he was like, oh great,
and I'll bring a bunch of students too. And I really admire someone like that who gives a lot
of credit where it is due and mentor students and gives them ownership. In a similar vein,
he's now running an entrepreneurship class, which is really exciting.
And I think I might Skype in for that class too.
Professor Anand also does some pretty heavy
computer science research,
but we don't get into that at all.
He also has his own startup that I think is
in a related computer languages space.
I think he does like provably correct code generation, that kind of thing.
But we don't get into that at all.
We mostly talk about constructivism, teaching kids,
ELM, functional programming, algebraic thinking.
And so without any further ado, I bring you Christopher Onand.
So today I have Professor Christopher Onand. So today I have Professor Christopher
Onand on the podcast. Welcome, Christopher. Thank you. One of the things that First God
is connected, and I think is one of the crazy things about what you do, is that you teach
Elm to students in K-8, like kindergarten through eighth grade and um and i just think it's it's hilarious
and really interesting that you teach elm to basically first graders so um could you tell
me a bit about um where you missed the idea to teach on the first graders so we uh we actually
have many different activities and um so teaching elm has till now, focused on grades four through grammar, which is common to English,
like putting commas in between things in lists. And what we found is that by grade four,
kids are, they know enough about grammar that, you know, with quite a few reminders, they will get it right.
So before that, you know, grammar is just such a alien concept to them, it's a bit challenging.
That said, we are working on an iPad app
for Elm programming, where it'll be impossible to create a syntax
error or a type error.
And we have tested it on a small number of classes.
And one of them was a grade one class and the teachers who were involved,
a librarian and a class teacher,
they,
I think they figured it's, you you know it's the end of June we it's hard to teach them anything anyway they were surprised that
the kids could could do this so they could learn the kind of Elm programming
that we teach yeah so maybe I should say that, I mean, for the listeners who know what a
DSL is, domain-specific language, we're really teaching our own DSL. So we're teaching,
and if you don't know what a DSL, so we have a library for creating graphics, and the focus is really on the library.
And the great thing about Elm and languages like Elm is that you can really teach that without getting bogged down in details of the language.
So we really focus on shapes.
So we have a system where all of our drawing goes through two steps. They pick a
stencil, so they use a function that makes a stencil. Stencil could be a circle, square,
rectangle, and so on. And then they have to either fill it in or outline it. And so we have those
basic two types, stencils and shapes. They can group the shapes,
give another shape, which is a compound shape, then they can move that around.
But really they focus on that. And because, because ALMA is a functional language,
it's possible for us to really do a lot without getting into the basic details of the language.
Other than syntax for lists,
really that's pretty much it.
Syntax for lists and R functions
and the kids can get going.
So with the Elm iPad app,
what ages is that targeted for?
How young does that go?
Well, I don't really know.
So we tried it with grade four.
You didn't really, I tried it with one class.
They didn't need very much introduction at all.
So I basically, um,
I showed them how to make some shapes and, um, then they started going and then they started
asking me questions. Um, you know, and they even, they even discovered things like if they have an outline circle, if you can picture an outline circle, and you know, kids, they love big numbers, so if you make an outline circle and you put a really big radius, then it just disappears and they have nothing on their screen. kids in grade four they they developed this hypothesis that oh this circle got so big we
can't see it anymore and um they came and asked me about that so it's very different from when we
are teaching um in the web-based interface where the kids are typing because at the beginning we're
really focused on just fixing syntax errors. We're just running around.
It's great exercise.
Physical exercise for the teacher.
Great physical exercise for us, yeah.
Because Elm has great errors.
I think that's one of the great things about Elm.
But for a kid who's never seen a syntax error,
great errors are still pretty much opaque.
Yeah.
So how long does it take, do you find,
on average, like an hour to kind of get the Elm syntax?
Like 10 hours?
Well, so our goal is that
we basically teach an hour and a half chunks
because that's what the school day is set up in.
So sometimes it's a bit less, sometimes it's even a little bit more.
But we take whatever their normal periods are
and we try to get them to draw something in the first period.
And then if we have a second period, depending on the class, we can either introduce simple animation or we focus on more complicated drawings.
Cool.
So if you would excuse me for a second, I want to talk kind of like directly to the people, some of my listeners who've listened to a lot of my podcasts,
because there's a lot of what you just said that I've referenced in past podcasts.
So I want to just kind of make the connection for all of the two people that I'm sure listen to my,
like who made it through all of them.
So we're talking about Elm,
which is a library that I've spent a lot of time researching and been inspired by, which is also very similar to CycleJS, the library that I'm currently kind of obsessed with and doing research around.
Also, like highly related is how you have a projectual editor for JavaScript, but then I wanted to pivot to build one for functional language,
which led me to Unison and Lambdew and Luna and Isomorph and then you guys.
So you're doing a lot of really amazing things in this future programming space
and also doing it in the context of teaching to kids, which is my space exactly.
So when I found you originally, it was like,
it was just kind of hilarious, um, how much we have in common. Um, and also how different our
approaches are, but I don't know. So I just wanted to, to make that all clear for everyone who was
listening, um, how similar you and I are and how similar our like interests and philosophies are here well it's great to talk to someone who's
made the same kind of discoveries um i mean it's taken us a long time to get to this point
so our outreach program you know necessarily involves people getting involved and then
graduating um so the institutional memory, I've got one
PhD student who's been doing this for a long time and then otherwise I have to
remember things. But we, you know, we've tried a lot of languages aimed at kids
and we've tried Python which is not aimed at kids, but there are a lot of curricula, curriculums,
if that's the right word,
written for teaching Python to kids,
probably a bit older kids than what we're teaching.
But we've tried Alice, we've tried Python,
we've tried languages, which I forget.
Certainly two different versions of Lego Mindstorms.
And actually, we tried using Haskell.
So in that way, I guess we're pretty adventurous.
Yeah, I'd say so.
But finally with Elm, really everything just works the way we want. And, I mean, we've made things, we've been able to customize things
by creating our own library for graphics. And, you know, we're not allowing kids to do all the things that people can do in Elm.
It's definitely a sandbox, but they can do quite a bit.
Yeah, well, and that reminds me, I wanted to say,
for the people who don't know what a domain specific language is
In the JavaScript front-end framework world we call them that more like a framework
It's like react.js is kind of like a DSL in a way or like maybe JSX is a DSL in a way
and then even more related
my Even more related, my library for kids to learn to code, WoofJS, is a framework that's very, very similar to what you're doing in Elm with your graphics SVG library.
So it's like a ton of overlap here.
Yes.
So, I mean, the difference is one of, it's, there are different flavors. So I think if you, some people like to build these kinds of languages in Ruby, but a language, so an ML based language really allows you to get a lot of the syntax from the underlying language out of the way, so that really what you see is the library.
That changes the flavor of it a bit, so that really what people are learning is the library.
They can do things without knowing the underlying language whereas I mean it's fundamentally these things
are all libraries but in some languages you can't really do anything without having a lot of
knowledge of the base language yeah well so you mentioned python and although
it wasn't really built for working with kids it um it's kind of been adopted by the teach kids
to code movement and everyone kind of is thinking that the next ap java ap computer science exam
will be like in python for example instead of java um and and what we're gonna yeah we're gonna
trade like void static main for underscore underscore main underscore underscore
so it's not that much of an improvement
I noticed in one of the papers you wrote that
when you were teaching Python you had to interleave boys and girls
to prevent them from talking to each other
but after switching from Elm you didn't have to do that
you could now encourage kids to work together
and so I'm just wondering why is Elm so much better than Python?
Is it just because the graphics library is better?
Is it easy to learn?
What about it?
Well, so we were using IDLE, the IDE IDLE for Python.
So I don't know.
Maybe there was a better IDE we could have used.
They got very frustrated with errors.
Errors can pop up in different ways. You have pop-ups, and they also appear in the console.
And it was easy to get errors.
They had more trouble.
So Elm has layout-based syntax. So it's like Python, indentation matters. But Elm is actually more flexible. So it's only when I started writing a parser for it that I realized how flexible it really is. So kids can write their code in very, you know,
hard to parse ways for someone used to neatly formatting their code. And it works. In Python,
they kept on getting tripped up by indentation. And, you know, if you're not used to counting whether you've got 18 spaces
or 19 spaces at the beginning of your line, chances are, you know, you're just not going
to see these problems. So that was one issue. But just you get to, I mean, there's a concept of, in psychology of working memory, and we all have, you know, a very similar amount of working memory, a number of things that we can keep in our mind, and that's usually about seven, which may have something to do with phone numbers. when your interface to the programming environment requires you to be solving problems just to get your program to compile,
then you're using part of that working memory that otherwise, you know,
we'd rather have the kids using all of their working memory on the programming problem that we want them to be focusing on,
right? And I mean, it's basically just a, it's the difference between a good interface and an
intuitive interface and a difficult interface. So we just, that's my, that's my hypothesis. We haven't done any testing that would verify that's what it is,
but just my experience as an instructor tells me
that the kids were spending so much time figuring out
how to type their code in
that they were losing sight of what the code was doing.
Yeah.
So another thing that I got from what,
I think it may have been the same paper,
is that you make a distinction between computational
and functional and algebraic thinking.
So I'd be curious, yeah, to get your rationale
behind those distinctions.
So if there are teachers who have used Scratch out there, where you are taking blocks and putting them in an order, and maybe even repeating blocks, then for me that's algorithmic thinking,'s not really about sequencing steps. It's about, at least when we start with our library, it's about how to draw things and it's about decomposing.
So it's about finding patterns that allow you to decompose a more complex picture or animation and break it into pieces that can be solved. So when people
program in all in any language you know nobody can understand a whole program
they have to break it up into pieces that they can understand bit by bit and
then they can piece together into a bigger structure. So, I mean, that's part
of programming. It's part of lots of, you know, thinking in science and even writing
essays, right? The difference is that with algebraic thinking, those pieces, they interact
in a more predictable way. Whereas in algorithmic thinking, the pieces interact in a more predictable way. Whereas in algorithmic thinking, the pieces interact
in a more complicated way. So if you want to make, you know, clever little puzzles,
there are a bunch of, you know, great drag and drop tools and iPad apps where kids can sequence operations and they have to
get robots to move through mazes and things like that, pick things up and hop over things.
But I mean, I think the real advantage of that is the kids are exercising their working memory
and they're maybe even making their working memory a bit
larger because they have to remember a lot of details in order to get this to work whereas
with algebraic thinking um we're trying to do complicated things without requiring kids to hold a lot of things in their head at once.
And algebra, so most people probably think of algebra as something to do with X's and
Y's and cancellation and things that they learned in high school, but algebra is a is a much richer thing if you study math at the university level or if you study
computer science and you get involved in the theory of computer science algebra is really
about how we structure things and it allows us really i think it's the best tool we have for knowing what our programs are going to do. So I'm a big advocate of teaching people at all levels functional programming
because I think it's a way that people can grapple with much bigger ideas than they could otherwise.
So for kids, those ideas are quite small, but they're building them up and we want them to have success. And we see them
having a lot more success when we use this algebraic thinking approach. Yeah, I really
resonate with the way you describe how the algebra you learn in school is related to algebraic thinking and true, deep mathematical algebra.
But it's almost like the algebra you do in Haskell or Elm, more related to computer science, is actually somehow more like real algebra and real, true mathematical algebra in some way and i i came to this as a kid
um in a way that's that's reminds me of how seymour pappert describes it so seymour pappert
um who many of the listeners of this podcast will know is like the father of teaching kids to code
he invented this language logo along with others and they were teaching it to kids
and um he the purpose ofo was to create a math land
where kids could explore mathematical ideas
through their curiosity.
So he would have students who hated math
and thought they were terrible at math
learn to love Logo and really enjoy making pictures
and various things with the logo turtle.
And he had this one girl who exclaimed how much he loved it.
And a teacher who didn't know what they were doing said,
oh, well, you know, this is math.
The thing you hate, you shouldn't hate it anymore.
And the girl vehemently said, no, this is not math.
Because in her head, it was a very different thing.
And I resonate with that because when I was a kid I also was was bad at math and then
I learned logo and learned Haskell and I knew that it was helping me in my math
classes but I thought it was just computer science I didn't realize that
it was more math than the actual math classes that I was taking until it was
too late until I was like wait a second I'm all sudden like good at this math
thing and I know what it is.
The other kids in my school don't actually know what math is because they're just doing school math.
I'm doing somehow more of a true math.
Yeah, so I mean, I was teaching a first-year class in the summer,
and it was using Python.
And I told them that a lot of what they learned specifically about variables after doing many years of algebra, it doesn't apply to this kind of algorithmic thinking or what people call computational thinking because variables are not um they're not definitions that you can rely on
they are just boxes which you can put values in for a certain amount of time and then
you can change the value another piece of your code that you're not thinking about could change the value and even very good students who eventually do figure it out they just
naturally make this mistake that when they're looking when they're casting
about to try to figure out what is this what's in this X that is being used in
this computation they will look in the wrong place
because um they're conditioned by having learned algebra and calculus to think about things in an
algebraic way so yeah so i i just to be clear you're talking about how in python um the yeah
the notions of variables are different than what you learn in math unlike an elm where the notions of variables are different than what you learn in math, unlike in Elm where the notions are much the same.
Yes.
Yeah.
So can you talk a bit about that?
So when kids come to learn Elm,
I think you've mentioned in various places that teaching variables and function
and state and types,
you mentioned that it's actually not that hard or not as hard as you think,
which I think to many of us is kind of shocking like like for example like i'm trying to teach functions in javascript and it's it's like quite quite a slog um so why how like how
does it work in elm like why is it easier um i mean really we've fallen into this way of teaching about variables and functions.
So basically, you know, people are going to learn something if they are already looking for a concept, and then you give it to them.
So, you know, kids, pretty much all kids love drawing.
And I think a lot of adults think, you know, wouldn't it be great to have time to draw again?
But we're too busy.
So, you know, drawing is a very natural thing.
Kids just love doing it. creating a complex picture by copying the primitive stencils and
transformations of the resulting shapes. They don't mind copying them to get
repeated patterns, but we can show them that instead of copying the same
structure over and over, they recognize they have the same structure. So in our talk,
we use the example of a flower. So you can make a flower, but if you want to make a field of flowers,
wouldn't it be helpful to have that flower saved? And so this is very similar to how
Papert describes it in his Mindstorms book. Basically, it's a shortcut for them. We just teach them this
is a shortcut. And now flower is going to always be equal to that sequence of shape or that
composition of shapes. And then if, you know, having a field of flowers, which are all the same
color would be boring, you can turn that
definition of a flower into the definition of a function, which takes one or two colors
and it colors the flower according to those input values.
So this seems to be pretty natural for the kids.
And they are, of course, already using functions. So to get a stencil of
a circle, they have to use the function circle, which takes the radius as an argument, right?
So we don't tell them that. In fact, we don't even tell them about that when we teach them
about functions, but they're already using some of that and then once they've drawn
Complicated shapes, they're ready for a way to
Reduce the amount of typing that they have to do right so they're ready for this concept and they accept it very quickly
Another concept where they're ready to learn it in this context is the Cartesian coordinates that underlie all the drawing.
In Ontario, in our curriculum, they're not supposed to learn about the four quadrants to use negative coordinates at any grade level that we've taught, so mostly grade 4 and up.
But you know, our sort of prototypical example of that is, we're drawing a face, we get an
eye on the right hand side of the face,hand side, we get an eye on the right-hand
side of the face, and then the kids want an eye on the left-hand side, and somebody in the class
is going to come up with the idea of putting in a negative number. And once somebody has that idea,
then, you know, it's not a teacher telling the kids, okay, this is the things that's going to
be on your math test. It's, you know, okay, I better pay attention to that because I want to be able to draw the same things that everybody else is able to draw. I mean, I think when you describe it that way, it's obvious kids are going to want to do that, right? you explain through various papers that I thought was really fun and cute is how you explain state
through state diagrams and flapping arms and quacking. I wasn't totally able to picture it
in my brain. Could you kind of walk me through how you explain state to students?
Okay. So first of all, I want to say that this is more difficult than variables and functions.
So we actually do a separate activity to get them, to help them build the concept.
So the separate activity is that we put a diagram up.
We, so our, usually we put up a couple of bubbles.
So one bubble says quackack one bubble says oink one bubble says moo we sometimes use other languages I'm sorry
other animal sounds and then between the bubbles there are arrows and the arrows are labeled by um actions so one arm two arms
sometimes we turn the lights on and off um and then we once the kids and then there's a starting
state so the bubbles are states so we're in a state and we can change into another state. Just like states of matter, which kids everywhere do learn about this age.
They learn about solid and liquid.
So many of them have seen a similar kind of diagram that comes in their science curriculum.
So we start them off, we get them them quiet and then lift up one arm and the kids you know
will wonder why is why is he lifting up one arm um it's we're supposed to lift up our arms when
we have a question so but you know looking at that picture they'll see okay there's an arrow that says from quiet to quack there's an arrow
that says one arm so one of them will quack usually they quack once so the idea of states
is that you are in a state and you stay in the state so we have to prompt them a bit to keep
quacking but then um then we can move around that state diagram, lifting up two arms or one arm,
and this is an example of where we use what of construction social constructivism but um we get the few
kids who figure it out right away to prompt the other kids the other kids will imitate
then maybe they talk to each other why are we doing this and they pretty soon the whole class understands this. And then in Elm, it turns out that we can pretty much transliterate that diagram.
We can encode that diagram in a very transparent way into a data type.
So they can see the diagram becomes a data type, or the bubbles become the choices in a data type, and the arrows become functions.
So different labeled arrows become functions.
So we can show them that,
or we jump to a simpler diagram
where something could be red or it could be blue,
and the arrow going in between is a tap.
And then we write a little Elm program where there is one button,
and when you tap on it, it will change from red to blue.
And if you then make the button move around on the screen
and add one more piece of state, which is the score, give them a score for tapping on the button, then the kids intent when I gave that example.
But, you know, they think it's pretty funny because they'll do things like,
if they've learned quite a bit, they will know how to make that button get really small
and move back and forth on the screen.
And that's funny for them.
And some of them say, well, you know, I'm going to take this
and get my little brother or little sister to play it.
Sounds like such a beautiful lesson.
I've heard of the peanut butter and jelly give instructions example before, which is a way to teach procedural algorithmic thinking.
But I haven't heard of any exercise like this that teaches algebraic thinking and I'm just so impressed.
It's such a beautiful exercise.
Yeah, well, I think it's a lot easier to really understand what the program is doing
if you teach it this way.
We, you know, our program is more about breadth than depth, so depth.
So we have mostly only got as far as
animation it's only a few classes who have gone farther and learned about games i mean there are
other classes who want to do more and we're trying you know we're trying to get to all the classes that are interested in our program. And one of the things on our to-do
list is to create a way for them to share these little games, because they do find them
fun. I think they love the animations, but a game, they're even more excited about the
game. So I think we can draw them in even more if we have a sort of arcade
where they can pick somebody's game and play it.
Yeah, I'm actually working on a similar kind of arcade
for Woof, the programming language framework I have.
I think it'll look very similar to how Scratches looks.
Yeah, I mean, lots of people have done similar things and i think you know everybody's
doing it for the same reason that it draws kids in and it's a good thing to do i mean it is a bit
of work on our part to implement it but totally um so let's see So, your program is pretty similar in philosophy and approach to the Bootstrap program.
I think they used to use Racket, but now they use a language called Pyret, which, from what I can see, it's their own custom language.
But it's, like, pretty similar in philosophy and approach to Elm in a lot of ways.
They have, like, a Big bang model of computation which is similar
to the elm architecture uh so i'm just i'm just curious um it's like it makes a lot of sense that
you guys kind of and just like how you and i are have come to similar things it makes sense that
you and them have come to similar ideas i'd be curious to know if you have any like ideas for
like comparing and contrasting the two programs how How you're different? Well, I think they were ahead of us.
I don't...
They may...
As far as I know, they were the first ones
who were trying to use functional programming to teach kids.
They are targeting an older age group and overlapping but...
Yeah, well I will just say that, so Seymour Pappert's logo isn't that functional but...
No, it isn't. So I mean, I think that Seymour Pappert was, I mean he really started this this whole field and he had a a ton of good ideas um but i you know
i think that one thing which people are going to say well that was uh in hindsight that was a
mistake is focusing on algorithmic thinking yeah well one thing that's funny um i saw a quote
somewhere that said that logo is was scheme the theisp language, disguised as like Fortran or Apple Basic.
So like it has a lot of the concepts of like a functional programming language, but kind of with the semantics of an algorithmic one.
But you're right.
It is definitely more procedural.
The one thing I did want to just throw in there to mention is that at the after school program I went to when I was a kid in South Florida, there's this program called IMAX.
And so after they taught me a few years of Logo, they moved me on to Scheme.
So I was like an eighth grader learning Scheme.
And those guys have been around for decades.
So I think they might have even predate the bootstrap program.
So I just want to put.
Okay.
Okay. yeah.
So I'm not an expert on history.
Yeah, that's what I'm trying to be.
I know a lot of people have done a lot of good work.
Yeah, totally.
I didn't mean to correct.
I just wanted to give credit to my beloved teachers.
You have mentioned to me before that
you've gone with Elm
because you came across it first and you like it,
but there are things missing from it.
For example, like type classes are missing.
And I'm just curious how you've thought about maybe leaving
and trying out PureScript or other alternatives
or maybe building your own language.
How do you think about those things?
So we did try using Haskell.
Not in a big way, but we did experiments with some classes,
with some classes where teachers have worked with us over several years,
and we can explain what experiment we want to do and they're okay with that so type
classes are really the biggest source of confusing errors for beginners in Haskell
so it's a mixed you know if we say we wanted to create a parser for elm in elm having no type classes would really
we would be pulling our hair out all the time but for kids who are beginning having no type classes
means that you know they're just a lot of things that they can't do wrong um cool so um this stuff uh particularly your ipad app building a like what we call a
projectional editor for holding functional programs in elm to me while it's really exciting what it
can what it can do for kids i feel like it could also be a really amazing environment for adults
to code in. Do you think about the work you're doing as being specifically geared towards kids,
or do you think that the libraries and tools you built could also be used by adults too?
That's a very good question. So I have thought about that a little bit,
because, I mean, in just testing the app, you know, I'm creating programs.
Um, I think, you know, we, all the IDs are kind of, they're getting more and more sophisticated, um, predictive filling in of code right so they you
know from the first letters that you type many will pop up alternatives that
this could be and you can usually use tab to get completion and often it will
give you what you were planning to type anyway, but a lot faster. So I see this as coming from the other end where there is no possibility of typing
and you can only choose things that the IDE is giving you as alternatives.
So I think for an object-oriented language, this would be very difficult. So if you try to do
text completion in Python, you get tons of methods that are built into every object or
built in at a very low level of the object hierarchy. So if you want to give the user all the possibilities, that is
difficult. So if you have a richly typed language, then the types, they narrow down the number of
choices that you can make as you're generating your code. And then it becomes much more realistic. So, you know, I don't, there's probably no other language which is
as small and as well typed as Elm. So this is the place, if it's going to work anywhere,
then I think it can work here. I guess, I mean, there are, you know, drag and drop languages for
kids which are basically doing this, but they are really small.
So, you know, Elm is a language that people can use for real work.
And still, I think we can do this.
Now, you know, we haven't tried to build bigger programs yet.
So we'll see what happens. Even if we fail on building the bigger programs,
the good thing is we can, you know, still declare victory that kids can use this, you know, for one
year before they graduate on to a more conventional environment. Or maybe they can use it for two
years or three years. We don't know. Interesting. So your idea is to build a beautiful environment for kids
and then kind of see how much you can scale it up to be adults to be useful for adults but
yeah however however much you can scale it up it's still useful for kids so
it's more like the adult would be like the gravy I mean, from a sort of startup mentality, we kind of have this one
market where we know we can succeed and maybe there's actually a much bigger market, um,
that's out there, but where the first market, you know, gives us, well, we don't make any money off of it, but we can succeed in the first market.
And then probably somebody else is going to have to take over who has more resources.
You're not going to start your own company, raise some money, try to take over the world?
Well,
I have a pretty busy day job. That's the
goal. Yeah, you
seem pretty darn busy.
Yeah.
So, I do actually have
a company that
licensed compiler technology
to IBM. And so,
I have a pretty good idea of
what the problems would be. And they mostly involve
time. So. Okay. Well, one idea that's related is I've, so there's Hopscotch and there's Scratch
and there's Scratch Junior, but these are all very procedural languages. I've been daydreaming,
and this is what you're building, a block-based
or at least a non-textual editor to build functional reactive programs more,
more algebraic programs. And so my dream is like a Scratch-like interface, but for more,
but less procedural, more algebraic, more functional reactive. So is that kind of what you're kind of going for? You're building like a scratch alternative that's more ML based?
Well, so practically the way things are implemented, we're basically using Apple's, you know,
rich text, text view and the ability to know which character got tapped on and the ability to add formatting
on top of the text. So it's actually a lot easier to implement this way. If we were really doing it
block-based, then we'd have to do a lot more programming just to get basic functionality.
So there's a practical reason why we can do more with text.
So if it's a very small language, like the existing Dragon or block coding,
that's pretty small, but if we want to really capture more of elm
more of a language like elm we'd be doing a lot of programming i think this i am tried to build a
projectional editor in javascript and i kind of backed my way into the same idea where if you use
just the text as a user interface you don't have to build blocks and people can just click on the
text and then detect on what piece of text they click on
and then give them options.
It just saves you so much development work
because you don't have to build this whole interface.
You can just use text, which already exists.
Right.
I mean, there's no platform that doesn't have a rich text.
Well, maybe OpenGL, I guess, doesn't have it.
But practically practically people have
already done a lot of work on displaying and selecting text so we get to use
that but there's also a social aspect to this you know in terms of selling this
we did an experiment comparing the iPad interface to the web-based interface.
And kids, you know, in grade 4, 5, 6,
they told us that, well, if they had to choose one of these
for teaching a new person, they would only use the iPad.
They said the iPad is easier, but they would only use it for younger children because they think that older kids and really old people, you know,
like their teachers and parents, wouldn't really think of the iPad as being programming
because you're not typing, you don't have a mouse.
So they have this, even at that young age,
they have this idea of what coding should look like
and what professional work should look like.
And some of them said personally they didn't like using the iPad because it,
you know, it didn't feel right, even though they said these things are easier.
Yeah. So tell me about it. I, I encountered this every single day. Um, and, and I, I used to fight
with kids a lot. I would really kind of push them to, to do scratch before they did woof.
But I, I eventually, I learned, um, to just not fight kids, just let them do what they want to do Scratch before they did Woof. But eventually I learned to just not fight kids,
just let them do what they want to do,
let them go to Woof even though they're not really ready for it,
and do what seems harder,
and then they'll either succeed and they'll be so proud of themselves
or they'll fail and then they'll decide on their own to go to Scratch.
But yes, I do see this as a real social marketing challenge for people like us who are trying to make things better and people don't want things to be better because the picture they have in their minds is that it's hard and looks a certain way.
Well, it's not even that it's hard, I think.
I mean, often they have no idea where the real complexity is.
Of course.
So, you know, some of them think you just start typing
and programs come out, right?
But they have this idea that this is what it should look like.
And, you know, it's the same you
a similar kind of issue comes up when people are designing a new you know web
tool and they make a file manager they make you know what looks like a file
manager and you ask why why did they do that? Because now you have all
this extra complexity about whether somebody was supposed to have created that artifact or not,
and now it's in your file system. And it's just, that's what a computer looks like to them.
That's in their mind. You move files around and then different applications open them.
So in their web system, maybe it's not applications, it's different processes.
But they want it to be focused in that way.
They're not really thinking about what does the user need to get done
and how do you avoid getting into bad situations where something didn't get done that needed to get done and how do you avoid you know getting into bad situations where something
didn't get done that needed to get done or a lot of work was done that has to be thrown out
so i don't i don't know if you see that the same way but uh yeah well i think the epitome of what
kids want or what they like kind of picture coding to be is exactly what you said.
They just type random stuff and programs get built.
And so if you want to see like a funny example of that, you can go to geektyper.net and click on one of the options.
And then you just type garbage, like literally just type garbage key, like any, just smashing the keyboard, just random keys.
And then like green text will kind of come down on the screen and things will pop up.
It looks like you're hacking into some secure system uh yeah kids like love that that
game um but then when you when you put them on scratch where they can actually build a real
program they're like no no no i don't this is this looks easy and is hard because scratch actually is
quite difficult for for students but they want something that looks hard it looks like coding
but then it is actually easy.
You're just mashing on random keys.
So finding a middle ground sometimes is difficult.
Yes, yes.
So, I mean, from my own experience of learning math,
I remember when I first saw new symbols for tensor product and semi-direct products of groups
and other symbols that appear when you learn more advanced algebra,
I was kind of drawn to that.
I remember that.
This is very exciting.
Really, you could have done the same thing without those new symbols,
but it was very appealing.
It looked like this is,
okay, now I'm really learning the serious math.
Funny.
Where my current research is at
is I'm working with this language called Cycle.js,
and the creator of Cycle.js, this guy, Andre Staltz,
he talks a lot about how Elm and CycleJS are very, very similar.
They're like two sides of the same coin.
And one of the things that makes CycleJS so great
is that when you write your app in this way,
it's a very stream-based functional reactive way.
You can visualize
your entire app as a state diagram.
And actually the dev tools, the Chrome dev tools for CycleJS will parse your code and
lay it out as like arrows and circles pointing at each other.
And then when you like click on different buttons, like the events, you can like see
the event flow through the diagram and update the state.
It's like kind of magical that they can generate that for you.
Yeah.
That's,
that sounds great because I think when people start writing,
um,
interactive programs,
they do have trouble understanding what's the data flow.
Yeah.
So,
you know,
you write,
you write code in different places and it's hard to see how it fits together.
Yeah, well, so even with all the experience of coding I've done, when I write CycleJS code, I still have so much trouble picturing in my head what's going to happen.
And once it's written, I can look at the diagram and kind of get a sense of things, but just writing it in the cycle js community including myself who are trying to
create tools to help the creation of programs through data flow diagrams so or something
thereabouts so i'd be curious to know if you think that that's like an interesting
uh like thread to pull on or if you think that because i know in the past when we've talked you
mentioned that you know people have tried tried text, have projectional editors or node-based editing, but we always
come back to text.
Do you feel like optimistic that we could come up with something like that or do you
think text is kind of the future, the past and the future?
So, you know, I don't know why, but these graphical tools for creating programs or creating the overall structure of the program
and then generating templates that get filled in in an editor these things don't they don't
seem to survive people often find this is interesting, but I think what happens is that
once people learn how a certain framework works, they don't need that anymore, and it
causes problems. So specifically, it causes problems for version control. You want to
know what changed in the program, and if the program is defined graphically,
you know, now you have to solve
potentially hard computer science problems
to show what's happening, right?
But then I think a big part of it is just that,
you know, other tools keep getting updated and there isn't interest in updating
this research project or there doesn't turn out to be a revenue stream attached to this
tool so these things don't get updated and then people go back to text. So I think this is very interesting that you write textual code,
but you get this graphical visualization
because that's maybe something that isn't going to be so hard to do.
It doesn't limit you to what somebody has made possible in the graphical editor, right?
If, you know, something comes along, nobody's implemented it,
you can still put it in your textual code.
But you still get this graphical visualization.
So, you know, when you're having your design meeting,
people have that graphical picture to refer to.
I think that's really powerful.
And when you're trying to onboard new people who, you know, are asking,
why can't we just do it the old way?
I knew how to do that.
Then this kind of tool can really help them.
So this sounds very interesting to me
as a way to get a lot of the benefit
of those graphical tools
without having the full cost,
which seems to be maybe too expensive to sustain.
But I mean, tools are getting better.
So maybe now it just isn't that expensive
and we could sustain it.
Okay, yeah, valuable thoughts.
I'm glad you're so excited about the automatically generated flow-based diagrams.
I was pretty jazzed when I saw those as well.
Yeah, and then, you know, if maybe the flow-based diagrams are not editable,
but you can click on nodes and it will open that code in your text
editor that would be extremely valuable yeah of course cool um sweet well i want to be uh conscious
of your time so um before we wrap up i wanted to take a moment to let you expose uh your public api
on the podcast like for example
if you want to like leave your email address or twitter handle or like kind of explain what you're
looking for is it like uh people to help with certain like contribute to any open source
projects or just whatever um if you had any thoughts there okay so i think that you can just type in graphic SVG.
Let me just verify that that works.
I'll make sure to put any links you reference.
If you reference the links, I'll magically have it in the notes for this podcast.
So you can describe it.
Okay, so we have a repository with our public code, Mac CAS Outreach, and we have our graphics library, Graphic SVG.
We have non-public code for the web tool that we use for programming and the web tool it it not only allows the kids to write their programs
without installing anything on the computer but it does have a chat box so that they can get help
so we're still working on what features that needs we'd be happy to share that code with
another group eventually we want to open source, but we're not at the point where
it's really ready. It's changing too fast and we have to, because we have children's data on the
system, we want to really think through the security before we open source it.
So we'd welcome collaborators on that, though.
And we do have one app that's on the app store for the iPad,
and it's called Image2Bits with a number two in the middle.
We haven't talked about that,
but it's... I mean, anybody who can understand this podcast
can probably figure out what to do with it
to teach about binary coding in a fun way,
and teachers love that the kids are doing math
and they think they're just playing a game.
So those are the three things.
And you can add my email address too.
Okay.
People could contact me.
Sounds great.
Well, thanks so much again for taking the time to chat with me.
I'm really excited to get to share this conversation with everybody.
Okay, well, thank you for having me.
It's been fun.