elm radio
Tune in to the tools and techniques in the Elm ecosystem.
Teaching Elm with Richard Feldman
Using Elm at work means teaching Elm. We learn some tips from Richard on how to introduce people to new Elm concepts.
Published
November 8, 2021
Episode
#43
Richard Feldman (
Twitter
) (
GitHub
)
Richard's Elm book
Elm in Action
Richard's Frontend Masters courses
Richard's talk
Teaching Elm to Beginners
Find motivation
Mloc.js conference
(by Prezi)
Pairing as a way to teach Elm
Intro to Elm Frontend Masters workshop exercises
are open source
South Park therefore/but storytelling technique
"I like teaching things the wrong way and then showing what's wrong with it."
The importance of finding good examples
Training From the Back of the Room
Dillon's
Elm JSON Decoder koans repo
Gradual release of responsibility
technique
Brian's
JSON Survival Kit
book
NoRedInk jobs
(looking for Elm and Haskell engineers)
Richard's Frontend Masters
advanced Elm course
and
Elm intro course
Transcript
[00:00:00]
Hello, Jeroen.
[00:00:02]
Hello, Dillon.
[00:00:04]
And finally, it's been a long time coming here, but we've finally got Richard Feldman
[00:00:08]
on with us.
[00:00:09]
Richard, thanks so much for coming on the show.
[00:00:10]
Hello.
[00:00:11]
Yeah, great to be here.
[00:00:13]
And today we're going to be talking about teaching Elm.
[00:00:16]
Richard, you've got so many talks introducing Elm.
[00:00:21]
You've got your front end master's course, you've got Elm in Action.
[00:00:24]
You've got a lot of advanced talks, but for me, I appreciate both the ideas you present
[00:00:30]
and the pedagogy behind them.
[00:00:33]
I think you make a lot of really advanced topics really palatable, and I admire that.
[00:00:37]
And I hope that we can share some of your wisdom with listeners today on how to do that.
[00:00:42]
People get very passionate about all these very advanced, cool things you could do with
[00:00:48]
Elm, but it's an important skill to be able to present them well.
[00:00:52]
So really looking forward to picking your brain about that today.
[00:00:54]
Wow, thanks.
[00:00:55]
That's very nice of you to say.
[00:00:57]
Oh, yeah, absolutely.
[00:00:58]
Yeah, no, I've watched some of your stuff for learning techniques.
[00:01:03]
And sometimes I actually went through Elm in Action when it was in the beta release,
[00:01:08]
just purely to see how you approach it pedagogically and how you sort of present the topics.
[00:01:14]
And it's really impressive stuff.
[00:01:16]
I remember that when I tried to pitch Elm at a previous company, I watched plenty of
[00:01:21]
your talks just to present it and it worked.
[00:01:26]
Nice.
[00:01:27]
You make it look easy.
[00:01:28]
And having gone through that process, I know how hard it is to find a good path to presenting
[00:01:35]
material.
[00:01:36]
So hopefully we can share some wisdom about that today.
[00:01:39]
Jeroen and I rewatched this ElmConf talk you gave about teaching Elm.
[00:01:45]
I really enjoyed rewatching it.
[00:01:46]
And so one of the key things you talk about is finding motivation, which I think is really
[00:01:54]
important.
[00:01:55]
And so in the talk, you say that using Elm at work means teaching Elm.
[00:02:04]
And I think that's one thing our listeners might find useful.
[00:02:08]
I think a lot of people will find themselves in a position where they need to teach somebody
[00:02:12]
Elm.
[00:02:14]
So what do you mean by finding motivation?
[00:02:17]
So I wish that I had rewatched that talk before coming out here so I don't contradict my past
[00:02:25]
self.
[00:02:26]
But I mean, the way that I think about it is if people are going to engage with whatever
[00:02:31]
you're saying, they need a reason to engage with whatever you're saying.
[00:02:35]
It's not a safe assumption that just because you're saying some words that people are going
[00:02:39]
to be hanging on every word and really engaging with whatever you're saying, it's pretty easy
[00:02:45]
to by default just start saying, here are some facts.
[00:02:49]
Let me just transmit these facts from my brain into your brain and have it just totally go
[00:02:53]
in one ear and out the other.
[00:02:55]
So yeah, I think anytime you're teaching something, it's important to establish why the student
[00:03:01]
ought to care about that.
[00:03:02]
Sometimes students will be intrinsically motivated.
[00:03:04]
They're just like, I'm here.
[00:03:06]
I want to hear exactly what you're saying.
[00:03:08]
Every word you say, I'm going to pay attention to it.
[00:03:10]
But it's definitely not a safe assumption.
[00:03:12]
So start by establishing that.
[00:03:14]
Find some way to connect whatever their interests are, whatever they're looking for with whatever
[00:03:19]
you're planning to be teaching them.
[00:03:22]
So what I gather from the talk is that you try to find motivation behind the design of
[00:03:29]
something like why is this thing designed this way now?
[00:03:38]
What benefits do you get out of it?
[00:03:39]
What problems does it prevent?
[00:03:42]
And so the motivation behind the design.
[00:03:46]
And that's what I get that you're trying to convey to the person trying to learn Elm.
[00:03:51]
And he talked about finding the problem that will resonate with the person.
[00:03:59]
Why does this matter to you?
[00:04:01]
Like types, why should I care about types?
[00:04:03]
Well, have you ever had this problem?
[00:04:06]
Oh yeah, I've had that problem.
[00:04:08]
Well, here's why types are important because they help with that problem that is important
[00:04:13]
to you.
[00:04:14]
So you have to find something that's important.
[00:04:15]
But that does like mirror something Jeroen and I talk about often on the podcast, which
[00:04:21]
is like getting into the shoes, the motivations of like an author of a package, for example.
[00:04:27]
There's an interesting mirror.
[00:04:29]
Let's talk about both of those real quick.
[00:04:30]
So I think the types example is really good because when I first started teaching Elm,
[00:04:36]
this was a been 2014 or 2015, definitely no later than 2015.
[00:04:42]
This was when like signals were still in the language.
[00:04:45]
I remember doing, I did, I've done a lot of like Elm workshops just off the cuff, you
[00:04:49]
know, like weekend type things.
[00:04:50]
Yeah, probably at least a dozen of them, like doing a whole weekend and signals was like,
[00:04:55]
that was a different level of difficulty to teach.
[00:04:58]
So yeah, it's really made things easier with those little way in ODOT 17.
[00:05:02]
A big thing that's changed between then and today is back then it was like, I'm teaching
[00:05:08]
everybody here knows JavaScript, TypeScript, not a thing, just did not exist basically.
[00:05:13]
I mean, it literally existed, but it was just this weird niche thing that like Microsoft
[00:05:19]
people use and that was it.
[00:05:20]
Today it's very different.
[00:05:21]
So today, if I were to try and use that same motivation that was effective back then of
[00:05:27]
like, oh, here's why you should care about types.
[00:05:28]
A lot of people are gonna be like, yeah, we use TypeScript.
[00:05:32]
What are you talking about?
[00:05:33]
You know, I don't know that that's still gonna resonate today.
[00:05:35]
I think what I would focus on more is like, okay, let's assume that the audience is all
[00:05:41]
TypeScript people, just for simplicity's sake.
[00:05:43]
I mean, probably in practice, you'll have a mix.
[00:05:45]
Some people are not on board with types yet.
[00:05:48]
Others are, but let's say I'm pitching to an audience of TypeScript users.
[00:05:52]
I'm trying to motivate them for like why they should understand this Elm stuff I'm about
[00:05:55]
to teach them.
[00:05:56]
I would focus on trying to understand what are the pain points that people have in TypeScript,
[00:06:00]
that they don't have in Elm.
[00:06:02]
So ideally I'd talk to people who've used Elm and TypeScript and say like, what do you
[00:06:06]
miss about Elm when you're doing TypeScript?
[00:06:08]
I know one of the things is like, okay, in the Elm ecosystem, like if you download an
[00:06:14]
Elm package and install it, all the types work.
[00:06:18]
Like they're all correct.
[00:06:19]
They're all like, there's never like mistakes or mismatches between anything like that.
[00:06:24]
Like if it compiles, it's like, yeah, it's gonna run properly because it's all one language.
[00:06:30]
And today you don't have that same level of confidence in like the TypeScript ecosystem.
[00:06:34]
So that's like an example of a pain point.
[00:06:36]
So if I'm trying to motivate someone, like, why should you learn this different type system?
[00:06:42]
I can say, here's a characteristic of this type system.
[00:06:44]
Like, hey, like Dillon said, is this a pain point you have currently?
[00:06:48]
Oh yeah, that is a pain point to have.
[00:06:50]
Cool.
[00:06:51]
Once you learn this, you won't have that pain point anymore in this world.
[00:06:55]
And then, okay, now I'm interested.
[00:06:57]
Now I want to hear what you have to say about, I'll learn this new type system so that I
[00:07:00]
can get to that point where I don't have this pain anymore.
[00:07:03]
But that might also change in the future.
[00:07:04]
Like if TypeScript becomes this pervasive thing and eventually everybody's writing all
[00:07:08]
their libraries and all their code in TypeScript, maybe that mismatch is not the top pain point
[00:07:13]
anymore.
[00:07:14]
Maybe it's something else.
[00:07:15]
You know, compile times, for example, you get all this TypeScript out there.
[00:07:18]
Like I know which compiler is faster.
[00:07:20]
So yeah, I mean, it's definitely not a static thing where you just assume the motivation
[00:07:26]
is always the same.
[00:07:27]
It's always contextual to like, what is this person, this student's, you know, what is
[00:07:31]
the thing that's going to resonate with them right now?
[00:07:34]
Not you know, not what used to resonate with them.
[00:07:36]
You always try to adapt to your audience.
[00:07:39]
Right.
[00:07:40]
Yeah.
[00:07:41]
Right.
[00:07:42]
And it's tempting to take your favorite things, your pet peeves and the things that get you
[00:07:46]
excited and then project that onto the person you're trying to teach or, you know, explain
[00:07:54]
why Elm is interesting.
[00:07:55]
So is there a connection between like pitching and teaching?
[00:08:01]
Like, yeah, absolutely.
[00:08:03]
I mean, I think especially in the sense of like, both of them involve understanding what
[00:08:07]
the other person, you know, what their life is like, like, what, what are their pain points
[00:08:12]
and also just like, what makes them excited?
[00:08:14]
What what are they interested in?
[00:08:15]
You know, there's, there's different things that will, you know, basically, like, you're
[00:08:20]
trying to find some common ground in a sense, like, in both cases, you're saying like, Hey,
[00:08:25]
I people have accused me of being an Elm evangelist, many times over the years.
[00:08:32]
But I've never really thought of myself as that way.
[00:08:34]
Because I'm not trying to convert people.
[00:08:36]
It's really just I'm trying to let people know that this option exists.
[00:08:40]
Because I'm like, I've had this great experience.
[00:08:43]
You might also have a great experience.
[00:08:44]
I want you to know that that is a possibility for you.
[00:08:47]
But if someone's like, Hey, I don't want to use Elm because of, you know, I'd rather use
[00:08:52]
this other thing.
[00:08:53]
I maybe I don't maybe I like JavaScript, maybe I like TypeScript, maybe I like PureScript.
[00:08:57]
I'm like, cool, I just want you to know that the options there, you know, so I don't, I
[00:09:02]
don't try to like pressure people to convert.
[00:09:04]
So for me, the pitch is really just like, is that like, is what I'm what's excited me
[00:09:11]
about Elm, like what I love about Elm, here are the things that I think, among those many
[00:09:16]
things that will resonate with you, like, probably not, it's not going to be 100% overlap,
[00:09:21]
there's going to be some things that I really like that maybe you don't like, or maybe you
[00:09:24]
dislike even.
[00:09:26]
Classic example of this, I remember, especially in the early days, there were a lot of discussions
[00:09:31]
where like a lot of people would say, you know, I'm really used to react.
[00:09:33]
And I really like the components where I can just take a date picker and just like, boop,
[00:09:36]
just call it and it's going to do all the state stuff for me.
[00:09:39]
To me, I always felt that I liked Elm's approach much better.
[00:09:43]
That was a selling point to me of Elm, which is that the state is very explicit.
[00:09:48]
There's one way to do everything.
[00:09:49]
There's no lifecycle hooks.
[00:09:50]
There's no, now I, sorry, I shouldn't say hooks, because now that's like a different
[00:09:54]
thing.
[00:09:55]
Right.
[00:09:56]
But like, there's this amazing level of simplicity in how the Elm architecture works.
[00:10:02]
And yes, the downside is that when you're like reusing stateful things, you cannot just
[00:10:07]
drop them in like you can in React and just say date picker, go.
[00:10:10]
And like, you know, one line of code, you have to change things in a couple of different
[00:10:14]
places.
[00:10:15]
And to me, that's so a price I'm so happy to pay for the benefit of like what the resulting
[00:10:21]
system looks like and how easy it is to understand like how all the data flows through everything.
[00:10:26]
But for some people, it's the opposite.
[00:10:28]
Like I have talked to people who like, even after becoming experts in Elm, they're just
[00:10:31]
like, yeah, I just still prefer the other way.
[00:10:34]
And that's totally cool.
[00:10:35]
Like it's totally fine for people to have preferences.
[00:10:37]
But if I'm trying to convince someone, like really the persuasive aspect is what I'm actually
[00:10:43]
trying to persuade people to do is to try Elm.
[00:10:45]
That is something where like legit, okay, fair enough.
[00:10:48]
Like I may not be trying to convert them, but I am trying to get them to try it.
[00:10:52]
And in that aspect, it's similar to teaching in that in both cases, I'm trying to find
[00:10:57]
a connection with the person, try to find out like what is going to get them interested
[00:11:01]
in what I have to say, whether that's how to use the language or why they should try
[00:11:06]
the language in the first place.
[00:11:07]
Right.
[00:11:08]
So with Elm, such a key part of what makes it an exciting language is that it's very
[00:11:15]
maintainable over time.
[00:11:18]
And how do you try to convey that to people?
[00:11:24]
That's a great question.
[00:11:25]
So I would say it's very context specific.
[00:11:30]
Different people have worked on different sizes of code bases and have run into maybe
[00:11:35]
different pain points with them.
[00:11:36]
So for example, if somebody is, if their main experience is doing mostly static HTML with
[00:11:41]
like a little bit of JavaScript, honestly, I probably wouldn't even try to mention the
[00:11:46]
maintainability aspect because that's just probably not something that's going to resonate
[00:11:48]
with them no matter what.
[00:11:50]
Like I've, you know, especially earlier on in my career, spent plenty of time doing mostly
[00:11:55]
static HTML with a tiny bit of JavaScript.
[00:11:57]
And it's like, oh, this is just not a maintainability problem because there's just so little code
[00:12:00]
there.
[00:12:01]
It just doesn't matter.
[00:12:02]
If I could read the whole, the code, the entirety of the JavaScript code fits in my one text
[00:12:07]
editor buffer, you know, it's like, all right, well, that's fine.
[00:12:11]
But if someone's got a much bigger JavaScript code base, they probably have pain points.
[00:12:16]
I mean, this is like the first conference talk I ever gave about Elm was at Prezi and
[00:12:22]
they had this conference called MLoc.js, M L O C dot J S. And that was short for millions
[00:12:28]
of lines of code.
[00:12:29]
And as I recall, the basic premise was Prezi had invested a lot in Flash and they had like
[00:12:37]
a million lines of Flash code.
[00:12:39]
And at some point, early on, this was a totally reasonable choice, but then Flash kind of
[00:12:46]
became, became clear that Flash is like, oh, this is going away.
[00:12:49]
Like this, we just can't actually do this anymore.
[00:12:51]
So like, well, what do we want to move to?
[00:12:53]
And the idea of having, instead of a million lines of Flash, a million lines of JavaScript
[00:12:57]
was, as you can imagine, like kind of scary.
[00:13:01]
So what they were looking for was like, how can we scale?
[00:13:04]
Like how can we have a huge code base that, you know, compiles to JavaScript or something
[00:13:09]
that runs in the browser like Prezi currently does, but without Flash.
[00:13:14]
And that was the theme of the conference was just people presenting on different ways to
[00:13:17]
do that.
[00:13:18]
So I think if you're dealing with a JavaScript code base of that size, you're probably familiar
[00:13:22]
with the maintainability problems of JavaScript.
[00:13:25]
Now, if you're dealing with TypeScript, you probably have different maintainability concerns.
[00:13:29]
Like I mean, the upside of TypeScript for somebody who is coming from JavaScript is
[00:13:35]
that you can introduce it incrementally.
[00:13:37]
The downside is that it's introduced incrementally with varying degrees of accuracy.
[00:13:42]
And that means that you get a different level of reliability out of your types than you
[00:13:47]
get out of Elm.
[00:13:48]
So I think if I were trying to convey to someone what the maintainability benefits of Elm are,
[00:13:54]
it would be a different conversation depending on if they're familiar with like a big JavaScript
[00:13:57]
code base or a big TypeScript code base.
[00:13:59]
And it would also depend on how big we're talking about.
[00:14:01]
Is it like a really small JavaScript code base or like a medium sized one or like a
[00:14:05]
million lines, you know, like where in that spectrum is it?
[00:14:08]
And same thing with TypeScript.
[00:14:11]
So I think like concretely, when it comes to TypeScript, I would talk about, here's
[00:14:15]
what my life is like when I refactor an Elm thing, or actually, maybe an even better example
[00:14:19]
is here's what my life is like when I upgrade a package.
[00:14:22]
Like I have still never found another language.
[00:14:26]
Rust is the closest.
[00:14:27]
But like in Elm, when I upgrade stuff, it just works.
[00:14:32]
Like I just it's just such a non pain point.
[00:14:36]
Like I just like, yeah, and then like, maybe, maybe something made a major breaking change,
[00:14:39]
like some package did, in which case, I'm like, okay, let's see what broke.
[00:14:42]
And then it's like, okay, I'll fix the compile errors.
[00:14:44]
And then once the type checks, look at that, I'm using the new package and everything works.
[00:14:48]
That's just so normal.
[00:14:49]
And it's so weirdly, it's almost like alien.
[00:14:52]
If that's not the experience, it's so rare.
[00:14:55]
Whereas like, I still have some JavaScript projects on like NPM.
[00:15:01]
And you know, like for my pre Elm days, I guarantee if I go and update those packages,
[00:15:07]
they're all gonna be completely broken, 100%.
[00:15:10]
And TypeScript is not going to fix that.
[00:15:11]
Like they're just going to be broken, and their types are going to be broken, probably.
[00:15:15]
So I think that's an experience that a lot of people can resonate with is like, yeah,
[00:15:19]
maybe all the TypeScript code that I wrote, you know, tends to work.
[00:15:22]
But as soon as I start bringing in other people's libraries, the maintainability is just, just
[00:15:27]
deteriorates.
[00:15:28]
But I still want the code sharing.
[00:15:29]
So of course, I'm going to use the libraries.
[00:15:30]
But just talking about like, what if you could have like, you know, as a baseline, really
[00:15:35]
reliable types, not just for your own code, but also all the like, the whole library ecosystem
[00:15:40]
is that way.
[00:15:41]
And that's only part of the story, obviously, there's also like, okay, there's a bunch of
[00:15:44]
stuff that you don't have to worry about in Elm that you do have to worry about in TypeScript.
[00:15:47]
And I've seen some trying to find an adjective that's sufficiently family friendly, while
[00:15:53]
also, I've seen some TypeScript types that frightened me.
[00:15:58]
That are just not things that you find in Elm, right?
[00:16:00]
Like it's really, I mean, just like, pick a random package in Elm package and try to
[00:16:06]
find the scariest looking type in there.
[00:16:08]
It's like, probably not that long.
[00:16:10]
That's true.
[00:16:11]
Yeah.
[00:16:12]
I may have made some of the worst.
[00:16:15]
Well, okay, but like, I'm not saying they're not there.
[00:16:19]
But it's like, they're hard to find.
[00:16:21]
Right?
[00:16:22]
Like, it's pretty rare.
[00:16:23]
I mean, I made Elm CSS, I'm aware of like, making crazy looking types.
[00:16:28]
Right?
[00:16:29]
You started your own down the path of the phantom builder pattern.
[00:16:32]
Cool.
[00:16:33]
Yeah.
[00:16:34]
But yeah, I mean, it's definitely contextual.
[00:16:40]
And it definitely depends on like, not just what are the characteristics of Elm, but also
[00:16:44]
like, what are we comparing to?
[00:16:46]
Like what's the person that you're talking to used to?
[00:16:48]
Right?
[00:16:49]
Yeah.
[00:16:50]
And if you can, you know, if you if you can sit down with somebody and pair with them,
[00:16:55]
that's like a really powerful tool to make it concrete as well.
[00:16:59]
Yeah.
[00:17:00]
Yeah, just seeing it.
[00:17:01]
So I had a funny experience with this, which is one of my co workers made the comment,
[00:17:07]
so he actually did not learn Elm as a beginner.
[00:17:10]
And he had worked at no rating, and he was basically focused on like back end stuff for
[00:17:16]
a long time.
[00:17:17]
And then he got into front end stuff after we'd already transitioned everything to Elm.
[00:17:21]
And so he was just coming in, like his first experience in Elm was in a huge code base.
[00:17:26]
We had I think back then we had like 300,000 lines of code now we're like almost half a
[00:17:29]
million and of Elm code.
[00:17:33]
And so the one of the first things that he did was like work, you know, in this giant
[00:17:36]
code base, like make some changes.
[00:17:38]
So he just got it right away.
[00:17:40]
He was like, oh, I get why this is great.
[00:17:43]
Immediately.
[00:17:44]
I just made some changes to this enormous code base.
[00:17:48]
I know like 0.1% of the code in this code base, and I made this like pretty invasive
[00:17:53]
change.
[00:17:54]
And then once it compiled, everything just worked.
[00:17:55]
Got it.
[00:17:56]
Like, this is great.
[00:17:57]
I see what all the hype is about.
[00:17:59]
And it's funny because then he subsequently would go to like Elm meetups and like teach
[00:18:02]
beginners and he's like, it's actually harder to teach people on like Hello World, like
[00:18:08]
what the benefits are, compared to like giving them a huge code base.
[00:18:12]
So I actually ended up revising based on that feedback, my front end masters course when
[00:18:16]
I when I redid the intro course, I made it so at first you're doing like Hello World
[00:18:21]
stuff like just from the basics.
[00:18:22]
I talked with Evan about this and and he made the point that it's also useful for people
[00:18:27]
to know like if you're making a new project from scratch, all you need is Elm make like
[00:18:31]
that's you don't need to do a whole complicated, you know, like thing you can just be like,
[00:18:35]
look, one file Elm make done.
[00:18:38]
So I basically started people off with that.
[00:18:39]
But then like partway through the course, I transitioned to like, okay, now we're going
[00:18:42]
to use the Elm real world example, we're gonna actually make some changes to this where like,
[00:18:46]
you're going to make some refactors and like fix some bugs and whatnot, as part of the
[00:18:50]
exercises.
[00:18:51]
And that was basically I'm trying to give people a sense of like, you know, that code
[00:18:55]
base is not that big.
[00:18:56]
It's like 4000 lines of code, but it's big enough that in the span of the exercise, you
[00:19:00]
have like, you know, five, 10 minutes to do each exercise, you don't have time to learn
[00:19:03]
that whole code base, you're just like, I don't know what I'm doing around here.
[00:19:06]
But I know that I'm trying to make this one change.
[00:19:09]
And so the hope is that people can get a sense of like, it doesn't really matter how much
[00:19:14]
code is around this, like, the compiler is going to make this be totally fine.
[00:19:18]
And hopefully I succeeded.
[00:19:20]
Yeah.
[00:19:21]
But
[00:19:22]
I really appreciate that.
[00:19:23]
And you open sourced your workshop exercises to for anybody who wants to try that out,
[00:19:29]
which is really, really nice.
[00:19:30]
So I'm curious, Richard, like, you've got all these great nuggets, and you like seem
[00:19:36]
to have like an infinite well of these, these, like hidden gems of little like Elm techniques.
[00:19:42]
And like, I'm kind of curious, how do you?
[00:19:45]
How do you develop ideas?
[00:19:47]
And like, you've got like this very clear map in your mind?
[00:19:51]
Like do you have like a note taking system that helps you with this?
[00:19:55]
Or like,
[00:19:56]
I'm, I'm very glad that it seems that way.
[00:20:02]
I just have a good memory.
[00:20:04]
No, no, no.
[00:20:05]
I think the reality is it's to the extent that I have things to say on these topics,
[00:20:10]
it's two things.
[00:20:11]
One is just, I think about it a lot, and like how to improve things.
[00:20:16]
And two is I just make a lot of mistakes.
[00:20:19]
Like I mean, I try things out.
[00:20:21]
And then like, I watch them like work or not, like I actually used to weirdly I so I always
[00:20:27]
make a list of like, what are the hardest things to teach?
[00:20:30]
Like what are the things that I struggle to teach?
[00:20:32]
And I measure that by like, the types of questions that students ask, and like also kind of their
[00:20:37]
expressions.
[00:20:38]
And so like, I know what they are right now.
[00:20:39]
But I remember one of them used to be well, so signals was always like the Okay, yes,
[00:20:44]
no one gets signals at it.
[00:20:46]
Another one was used to be type variables.
[00:20:49]
Like I used to struggle to teach that because I would like try to give people examples.
[00:20:54]
I don't even remember what examples I was using.
[00:20:56]
But I just like, people would always be like, okay, so then, is this is this true?
[00:21:01]
And I'd be like, no, not like that.
[00:21:03]
Let me give you a different example.
[00:21:04]
Like I tried to like make stuff up on the fly, because my slides, obviously, we're not
[00:21:08]
not doing the trick, these workshops.
[00:21:11]
And what I ended up figuring out is that all I needed was like a really basic example that
[00:21:18]
just demonstrates something like something where they understand what's going on.
[00:21:22]
And and then I can just like explain to your point earlier about like, the motivation of
[00:21:27]
like why type variables exist, and then they would get it hopefully.
[00:21:31]
And so the example I came up with was list dot reverse.
[00:21:34]
So basically, I was like, okay, here, I'm going to call list dot reverse, not not showing
[00:21:39]
any types, just saying list dot reverse on a list of strings.
[00:21:42]
And you see that it reverses the strings like, yes, obviously, everybody knows that.
[00:21:44]
Then I'm gonna do it on a list of numbers.
[00:21:47]
And I reversed it again, like, yes, obviously, that works.
[00:21:50]
I'm like, okay, so what's the type of list dot reverse?
[00:21:53]
What's obviously not list string to list string?
[00:21:56]
That wouldn't make sense, because it can also do numbers.
[00:21:59]
So how do you how do you have both?
[00:22:01]
This is the problem that type variables solve.
[00:22:02]
So it's actually list a to list a and then the lowercase thing means, I don't know what
[00:22:07]
this is, it could be a string, it could be a number.
[00:22:09]
But whatever it is, it's going to be the same in both places.
[00:22:12]
And so with that really simple example, where like, everybody understands each of the individual
[00:22:16]
pieces, they understand the motivation for like, why you need a language feature to solve
[00:22:20]
this problem.
[00:22:21]
And it's like, all of these are like single argument functions, everybody knows what list
[00:22:25]
dot reverse does, like really obvious, the type of like list string to list string, and
[00:22:29]
then like list number, I think I may have used bool or something instead of number just
[00:22:32]
so I don't have to get into the whole like, that thing.
[00:22:35]
Oh, no, maybe it was int, I might have used whatever, it doesn't matter.
[00:22:39]
Point being, it's like, I can use a really simple example that where everybody can understand
[00:22:42]
each piece of it.
[00:22:43]
And then it just wasn't a hard thing to teach anymore.
[00:22:46]
That was it.
[00:22:47]
So there are other things where I have not been as successful in figuring out a great
[00:22:51]
way to teach it.
[00:22:52]
But maybe they're out there.
[00:22:53]
So it sounds like it's just a lot of experimentation that you like, try things out, you try things
[00:22:58]
out in code, you try things out in ways of presenting things, and then you just iterate
[00:23:03]
on that.
[00:23:04]
That's, that's interesting.
[00:23:05]
Yeah, and there's also a lot of like, I mean, as a baseline, I usually would start with
[00:23:08]
like trying to put myself in other people's shoes.
[00:23:12]
I also, I also would start with thinking about like, what was hard for me when I was learning?
[00:23:17]
And like, what are those things do I think are specific to me versus what do I think
[00:23:21]
is like, probably a common experience?
[00:23:24]
Like I mean, one of the big things that I went on a different podcast, and I was talking
[00:23:28]
about teaching functional programming in general.
[00:23:30]
Actually, I guess I've done that on a couple of podcasts now.
[00:23:34]
But one of my sort of like pet peeves is that it's it seems very common to teach functional
[00:23:40]
programming by starting very differently than how you start teaching any non functional
[00:23:47]
programming language, like any non functional programming language.
[00:23:50]
It's always like you start with or non pure functional, even, you always start with Hello
[00:23:54]
World.
[00:23:55]
And then you're like, let's let's build a thing that does this, you know, whereas it's
[00:23:59]
very common in pure functional languages, especially to start with, all right, here's
[00:24:03]
how types work.
[00:24:05]
And like, eventually, we're going to actually like make a program that does something, but
[00:24:10]
it's probably not going to be Hello World, it's probably going to be like, you know,
[00:24:13]
working with like, you know, the numbers in some way.
[00:24:18]
And that just never resonated with me.
[00:24:20]
I'm like, I like programming, because I like to build stuff.
[00:24:23]
And I don't think that's unique to me.
[00:24:26]
I think that's the norm.
[00:24:27]
That's like the default is like most people like, like, to build things with their software.
[00:24:32]
So you know, in Elm, like Hello World is, to me is like is about view.
[00:24:37]
It's like, let's render a thing on the page.
[00:24:39]
So I'm always like, whatever I'm teaching, I want to get beat the fastest path I can
[00:24:43]
get to to like, let's get somebody rendering, even if it's just static at first, you know,
[00:24:47]
you don't even need like Elm architecture yet.
[00:24:49]
It's just like, you made a thing.
[00:24:51]
It's right.
[00:24:52]
Yeah, it's useful.
[00:24:53]
It's like it's something.
[00:24:55]
And then later on, I will layer types on top of that, like an introduce, like, here's the
[00:25:00]
types of the stuff you've been building.
[00:25:02]
So I actually, in all the things that I teach, like in all the beginner material that I do,
[00:25:07]
one thing that's very consistent, like, often I'll use different backing examples, I'll
[00:25:11]
use like, you know, different exercises, whatever.
[00:25:14]
But one thing that's very consistent is it's like, first teach you like the language basics,
[00:25:18]
like you need to have some vocabulary to be able to be able to do like, Hello World usefully.
[00:25:23]
So it's like language basics, like syntax and stuff, then Elm architecture with with
[00:25:29]
the messages being records.
[00:25:30]
Yes, I remember that from Elm in action.
[00:25:33]
And then that plants the seed for the motivation for union types or custom custom types.
[00:25:40]
Exactly.
[00:25:41]
Yeah, because because like, I and I always go out of my way to show like, let's suppose
[00:25:45]
we tried to keep going with records like this, you know, because in a small example, records
[00:25:49]
actually work fine.
[00:25:50]
Like if you have a small contrived example, but pretty quickly, it's like, I don't have
[00:25:54]
to add too many capabilities before it's like, Oh, this is not gonna go well.
[00:25:57]
It's like, okay, now I'm going to show you the fix for that.
[00:26:01]
And then that's actually like, where I get into types.
[00:26:04]
Well, so usually, I'll start teaching types first, and then I'll be like, okay, cool.
[00:26:09]
That's enough, you know, understanding the types.
[00:26:11]
And usually, I'll actually explain it in the sense of like, let's add type annotations
[00:26:14]
to what we just did is like kind of the next exercise.
[00:26:17]
And then I build from there into like, okay, now we wanted to add more things to this record.
[00:26:21]
Oh, and yeah, because because that concept of custom types is really new to a lot of
[00:26:27]
people.
[00:26:28]
Because even in like, TypeScript, I don't think you have something like directly right,
[00:26:32]
there's not a tagged union, it's just a small step from the concept of an object.
[00:26:37]
And you sort of add a discriminant.
[00:26:40]
I mean, there's like, I think there's like enums, that's true.
[00:26:42]
Yeah.
[00:26:43]
In your writing, but yeah, yeah, the the South Park showrunners have this like, sort of storytelling
[00:26:51]
technique that has always stuck with me, which is they, they say that you can tell if something
[00:26:58]
is like a compelling story or not, by taking the core plot points, and seeing if you can
[00:27:05]
connect them, rather than saying, this, and this, and this, and this, if you can say this,
[00:27:13]
therefore this, but this, that shows that they're pushing each other towards the next
[00:27:19]
thing, and they're connected, and it compels you towards the next point.
[00:27:24]
Otherwise, they're just sort of disparate events that are happening, but it's compelling
[00:27:29]
when something is propelling you to the next thing.
[00:27:33]
And so, you know, I really like that technique you're describing of like, having having a
[00:27:40]
record for the message type, even if it's not idiomatic, even if it's not, I think,
[00:27:46]
as Elm developers, we really care about how powerful this system is.
[00:27:51]
And like, look, when you're using it, well, look at this awesome thing.
[00:27:54]
So we want to jump straight to that.
[00:27:56]
But then you're missing the opportunity to actually compel, like, okay, I taught you
[00:28:03]
this thing, but now there's a problem with that.
[00:28:06]
And you actually want to plant the seed of a problem.
[00:28:08]
So it lets you do two things.
[00:28:09]
Number one, it lets you plant the seed of a problem that you can introduce a new technique
[00:28:13]
to solve.
[00:28:15]
And number two, it makes it so you don't have to introduce that, that next thing you're
[00:28:19]
going to introduce earlier.
[00:28:22]
So you can start simpler, have fewer plates in the air.
[00:28:27]
Yeah, I like teaching things the wrong way, and then showing what's wrong with it.
[00:28:32]
I think that's like a helpful, helpful technique.
[00:28:35]
There's a section in Elm in action where I actually, there's sort of a like fork in the
[00:28:38]
road where it's like, well, we could do this in one of two ways.
[00:28:40]
I don't remember what it was anymore, but it was around chapter four somewhere, could
[00:28:43]
be misremembering though.
[00:28:44]
I'm like, we could do it this way, or we could do it this way.
[00:28:48]
Both ways seem reasonable.
[00:28:49]
Let's just do both and see what we like about both approaches.
[00:28:53]
So I actually like in the page, it's like I put them side by side, and I just like,
[00:28:57]
draw out like, here's what we're doing.
[00:28:58]
So you can kind of see like, what are the differences.
[00:29:01]
And then at the end, it's like, okay, so like, what are the characteristics of each of these?
[00:29:05]
Oh, like this one seems to have more upsides than this other one.
[00:29:09]
And I specifically did that because the one that I wouldn't choose, I think is like a
[00:29:12]
little bit more concise.
[00:29:14]
And I think that's, it's often I found more difficult to teach a sort of technique where
[00:29:22]
it requires you to like write more code than the technique that I don't recommend.
[00:29:30]
Or that I think is worse, for some reason, because, like, we have all these heuristics
[00:29:35]
for evaluating whether something is a good idea or not.
[00:29:39]
And that's just such an easy one is like, which one's shorter?
[00:29:42]
Well, all else being equal, prefer that one.
[00:29:45]
The problem is all else is basically never equal.
[00:29:48]
And so there's always this question of like, how do you evaluate the trade offs and like,
[00:29:52]
convince yourself that like, okay, even though this is more verbose, it's actually better.
[00:29:56]
Quite often it is.
[00:29:57]
But I always have to be aware of that if like, if I'm trying to say like, this way is better,
[00:30:02]
trust me, I need to substantiate that more.
[00:30:04]
Like if it's more verbose, like I need to give more of an explanation of like, okay,
[00:30:08]
yes, this will be more concise.
[00:30:09]
But look at these problems.
[00:30:10]
Those are more serious problems than verbosity, especially if it's just a little bit of verbosity.
[00:30:16]
What I really like about Elm is that since it's easy to maintain, easy to refactor, something
[00:30:21]
I often give as advice to people is just try things out.
[00:30:26]
It will be pretty easy to undo and to do the other option that you thought about.
[00:30:32]
So I think it was a great idea to do both ideas and to compare them.
[00:30:37]
Yeah.
[00:30:38]
And if I think about how like giving advice to somebody who's trying to, you know, introduce
[00:30:44]
Elm to a coworker or teach somebody who's starting out with a new concept in Elm, I
[00:30:48]
think, I mean, if I put myself in their shoes, which we all can, it's so tempting to, you
[00:30:56]
know, just jump straight to the motivation.
[00:30:58]
But you want to, you know, remember to start with a compelling thing that showcases the
[00:31:05]
problem, which sometimes means not doing something idiomatically, not doing something the best
[00:31:10]
way you know how to in Elm.
[00:31:13]
Have an economy of concepts.
[00:31:17]
You want to introduce as few concepts as possible.
[00:31:20]
And then you want to see how the thing you're introducing is going to bridge the gap to
[00:31:25]
the next thing.
[00:31:27]
And it takes some discipline, you know, but it's interesting because on the one hand,
[00:31:34]
it is sort of a checklist.
[00:31:36]
And if you really look at that checklist and say, okay, am I introducing more than one
[00:31:41]
concept at a time here?
[00:31:43]
You kind of know, and you can go through that checklist and make sure, but you need to do
[00:31:48]
that deliberately.
[00:31:49]
But then there's also, it requires creativity and it takes practice to get good at finding
[00:31:54]
good examples.
[00:31:55]
Finding good examples is one of the most difficult skills.
[00:31:59]
And it's one of my biggest pet peeves and one of my favorite things when people really
[00:32:04]
nail it, whether it's like package documentation, a tutorial, a read me for a project, whatever
[00:32:10]
it may be, when people nail the examples.
[00:32:15]
So like I'm a big fan of Sharon Bowman's like teaching methods.
[00:32:20]
She's got something called training from the back of the room.
[00:32:24]
And one of the things she's really big on, this is for, you know, people doing workshops
[00:32:29]
and things like that.
[00:32:30]
And I used to do a lot of workshops and like, she would always say like, don't get a room
[00:32:36]
full of people doing an icebreaker activity and like learning people's names and stuff.
[00:32:42]
She says like, that is a golden opportunity to teach people what they're there to learn.
[00:32:48]
So if they're there to learn about Elm, then instead of learning their names, why don't
[00:32:56]
you have them introduce themselves to someone and tell them what language they're used to
[00:33:02]
and what they already know about Elm and what they think might be different.
[00:33:06]
And now you're actually taking that opportunity to do what they're there for.
[00:33:12]
And to me, examples are the same thing.
[00:33:14]
Like if you do Fubar, you know, then you're missing an opportunity.
[00:33:21]
Every example is an opportunity to give motivation of why something is meaningful.
[00:33:27]
It's an opportunity to show a meaningful use case.
[00:33:31]
And if you do those things, it's going to stick in people's heads better.
[00:33:34]
So they're not because the way our brains work, our brains aren't just collecting disparate
[00:33:40]
pieces of information.
[00:33:41]
Our brains are association machines.
[00:33:43]
So if you can like take a problem and also the things that our brains will more strongly
[00:33:50]
remember things that are meaningful.
[00:33:53]
So if you can motivate a problem, connect it to the real world situation, and then have
[00:33:59]
that association to an a code technique or example, suddenly you've created this rich
[00:34:05]
field for people to remember something and understand it more deeply.
[00:34:09]
So yeah, I'm such a proponent of coming up with really good examples, but it's not easy.
[00:34:15]
It requires creativity.
[00:34:16]
Yeah.
[00:34:17]
Yeah, it's definitely hard.
[00:34:18]
I was thinking about, you mentioned like the checklist.
[00:34:21]
And another thing that comes to mind is when you're teaching a whole course as opposed
[00:34:25]
to like an individual concept or an individual example, you don't just have a checklist,
[00:34:30]
but you also have a dependency graph where it's like, in order for me to teach custom
[00:34:34]
types, you have to know about type annotations first, because otherwise I can teach you how
[00:34:38]
to do an enumeration version of it.
[00:34:40]
But as soon as I want to put like a payload in there, you need to know what types are
[00:34:44]
to say like, you know, what's going in there.
[00:34:47]
Likewise, you know, before I can teach the LM architecture, I need to teach you how function
[00:34:50]
calls work because that's going to come up and so on and so forth.
[00:34:54]
So there's this whole dependencies of like, before this concept can be taught, there are
[00:34:59]
these prerequisites, but then you don't want to just be like, oh, well, I'll just dump
[00:35:02]
all the prerequisites and then I can teach the thing.
[00:35:04]
It's like, well, no, like you said, you got to try and teach one, maybe two things at
[00:35:08]
a time, small number of concepts introduced incrementally.
[00:35:12]
And then yeah, it's like, what's the sequence of those?
[00:35:15]
And then another thing that comes up is, do you want to try to connect examples to previous
[00:35:22]
examples?
[00:35:23]
And if so, like, how frequently do you want to do that?
[00:35:25]
So I took the extreme approach to this element action, which in retrospect was, it's the
[00:35:31]
type of thing that I only did because I didn't know what I was getting myself into.
[00:35:36]
And like the entire book, like starting from chapter two is building up one giant code
[00:35:42]
example.
[00:35:43]
Like every single chapter is like, we're going to add, well, you're building this application.
[00:35:46]
It's like a photo browsing library.
[00:35:47]
And every chapter you add stuff to what you did in the previous chapter.
[00:35:50]
And then by the end of the book, you have a whole like multi single page app, but like,
[00:35:54]
you know, multiple quote unquote pages.
[00:35:56]
And you wrote, you know, every line of code of that app, including like refactors and
[00:36:00]
changes over the course of the, you know, the preceding chapters.
[00:36:04]
One thing I learned the hard way about doing that is that if I realize like midway through
[00:36:09]
chapter three, where I'm introducing types that like, I want to do something differently.
[00:36:15]
And I want that code to end up in a different place.
[00:36:17]
I now have to go back to chapters one and two and potentially update those.
[00:36:21]
That's not that big of a deal.
[00:36:22]
If I realize that in chapter seven, like it's a change that like happens to affect all the
[00:36:27]
preceding chapters.
[00:36:28]
I don't have to go through and update them all by hand.
[00:36:30]
And it's not just like I'm going through and updating the source code.
[00:36:33]
It's like, I have to update the English words around them that explain those concepts.
[00:36:37]
Because maybe there's a whole concept that needs to be introduced like in a slightly
[00:36:40]
different order.
[00:36:41]
So some of these cascading changes got very expensive time wise, especially as things
[00:36:47]
progressed, which is going to be my excuse for why I slowed down.
[00:36:51]
And like, it took me longer to like write the last few chapters than the first few chapters.
[00:36:56]
Yeah, it's I agree.
[00:36:58]
Making examples is like, very difficult to do well.
[00:37:01]
So if you if you did element action again, would you have like more decoupled examples?
[00:37:06]
Or do you think it was worth it in terms of the meaningful connections?
[00:37:10]
I would think of it in terms of if I were to do another book, I wouldn't choose to do
[00:37:15]
it again.
[00:37:16]
But I think I still would have wanted to do it once just because I've never read a book
[00:37:19]
that did that.
[00:37:20]
And I that was like, I don't know, I'm an ambitious person.
[00:37:22]
I wanted to see like, can it be done?
[00:37:24]
Like, why not?
[00:37:25]
You know, so now I'm sort of like, I'm, you know, I'm older, I've learned some things.
[00:37:29]
I'm like, Well, I don't know if anyone else has tried to do this.
[00:37:32]
Or like, I don't know of any examples.
[00:37:33]
I'm sure they're out there.
[00:37:34]
I guess I'm not sure.
[00:37:35]
But maybe they're out there.
[00:37:37]
But now at least I know a reason not to.
[00:37:39]
Yeah, I know a compelling reason not to do it.
[00:37:43]
Was it worth it?
[00:37:44]
I don't know.
[00:37:45]
I hope so.
[00:37:46]
For reasons, but okay, cool.
[00:37:49]
That's good to hear.
[00:37:52]
The whole book is amazing, I think.
[00:37:54]
Thank you.
[00:37:55]
Yeah, I really like this.
[00:37:57]
I mentioned earlier that I read Elm in Action for for pedagogical reasons, because I like
[00:38:02]
knew those things, but I'm like, how is he going to present them?
[00:38:07]
And I enjoyed reading it, you know, for those things.
[00:38:12]
And it's sort of like a murder mystery or something where you want to end on a cliffhanger,
[00:38:18]
like every chapter, every section should end on a cliffhanger.
[00:38:22]
So you're like, how's he going to solve this problem?
[00:38:25]
And if people are asking that, that means you've found motivation, you've connected
[00:38:29]
it to people's motivation.
[00:38:31]
And every example in itself is both an example and creating motivation for the next thing.
[00:38:38]
So I just love when you can pack more than one thing into, you know, like have something
[00:38:45]
be multipurpose like that.
[00:38:48]
That's impressive pedagogical technique.
[00:38:52]
Thank you.
[00:38:53]
I yeah, I guess I wasn't thinking of it in these terms.
[00:38:57]
But maybe I got that from fiction writing.
[00:38:59]
So like in fiction, you sort of like, the ideal is that you have like a paragraph and
[00:39:04]
you want it to be doing like something like quadruple duty.
[00:39:07]
So it's like you want to be okay, yes, I want to be advancing the plot, like, you know,
[00:39:12]
saying like, what's happening.
[00:39:13]
But also, ideally, I also want to be developing characters somehow, like not necessarily every
[00:39:18]
single paragraph.
[00:39:19]
But it's like, if someone's doing something, it shouldn't just be they're doing that, because
[00:39:23]
that's what the plot requires.
[00:39:24]
But also because this is revealing something about the character or changing the character
[00:39:29]
in some way.
[00:39:31]
And then you have like, okay, so not just those things.
[00:39:33]
But also there's like, pros, like, what are the words that I'm choosing to write it?
[00:39:37]
Like, are these like, creating vivid imagery in the reader's mind?
[00:39:41]
Is this like, a word that they don't know, and they have to like, stop reading and go
[00:39:45]
like, look at, get a dictionary or something to understand it?
[00:39:48]
Like, there's a lot of just like, you know, individual level things.
[00:39:52]
So and then there's also just like, setting, like, what is this, you know, what's going
[00:39:56]
on here?
[00:39:57]
Am I painting a picture of exactly what's going on in this place?
[00:40:00]
Or maybe I don't want to.
[00:40:01]
So it's just like all these different elements.
[00:40:04]
And like, the final product is like, as a reader, I'm just like, oh, this is paragraph,
[00:40:07]
I read it, and like, things happen to my brain.
[00:40:10]
But as the author, I have to be thinking about all those things at once.
[00:40:12]
And I think it's the same kind of thing with teaching where it's like, yeah, ideally, maybe
[00:40:16]
it's more work that I want to do again.
[00:40:18]
I don't know.
[00:40:19]
But, but it's like, ideally, yeah, it's like, I'm not just teaching you this concept, but
[00:40:23]
I'm also teaching you like, you know, yeah, like setting motivation for the next thing,
[00:40:28]
giving you a deeper understanding of like, why we did it this way, instead of this other
[00:40:31]
concept.
[00:40:33]
And like, and also, you know, giving you like, a concrete example to build on the next section.
[00:40:38]
In the Elm Conf talk, you gave a you talked about like, not getting too caught up on giving
[00:40:45]
all the details and trying to like, be honest, but not necessarily thorough.
[00:40:52]
Because, you know, at the expense of throwing too many concepts at once at people.
[00:40:57]
So like, how do you balance that line, right?
[00:41:00]
Because it I mean, we've all been, you know, if we're introducing Elm to people, I know
[00:41:06]
we've all been in that situation where your brain is firing off all these things you need
[00:41:10]
to tell somebody about the question they just asked, like, how do you navigate that?
[00:41:15]
Yeah, that's a great question.
[00:41:17]
So I would say the first thing that comes to mind is, if I've got this sort of mapping
[00:41:23]
of like, here are my dependencies, here's my checklist of like, things that I want to
[00:41:26]
be true about, like, what concepts I'm teaching in what order.
[00:41:29]
Basically, my sort of guiding principle is, I don't want to go off on a big tangent that's
[00:41:35]
going to result in my teaching a whole new concept here.
[00:41:39]
Because like we talked about previously, like, I don't, I don't want to teach too many things
[00:41:43]
at once.
[00:41:44]
One way I can potentially accidentally teach too many things at once is, if I'm midway
[00:41:49]
through teaching this one concept, and a student asks a question.
[00:41:52]
So classic example of this is starting off in the REPL, and I'm just like, you know,
[00:41:57]
one plus one, or I'm doing like a string concatenation or something like that, like, put in the string,
[00:42:02]
hello world, you know, concatenate another string.
[00:42:04]
But another thing that I might do is I might put in like, one plus two.
[00:42:08]
And if I do that, then the REPL is going to say three colon number and number is lowercase.
[00:42:13]
And if somebody notices and asks a question, like, how come that one's lowercase, the other
[00:42:17]
one's uppercase, I could be like, well, let me talk about type variables.
[00:42:20]
And then like, no, no, no, we're not there yet.
[00:42:23]
We don't need to go into all that.
[00:42:24]
And in fact, I don't even think if you're doing a beginner workshop, you need to explain
[00:42:29]
that concept at all.
[00:42:30]
Because on the one hand, like, yes, like, there's number comparable, appendable, and
[00:42:33]
even if you want to get really advanced, complement, but like, like, the upside of how those work
[00:42:39]
is just like, yeah, numbers work the way you expect them to, like, plus works on integers
[00:42:43]
and floats.
[00:42:44]
Like, it's not like if you don't teach that, people are not going to be able to use L,
[00:42:49]
like, especially beginners, right?
[00:42:51]
In an advanced course, sure, you can you can get into those, like, if you know, if people
[00:42:53]
are interested in that, but that gets into that question of like, how thorough do you
[00:42:57]
want to be?
[00:42:58]
And it's like, really, I think it comes down to thinking about, if I want to actually teach
[00:43:02]
you this, how much time is it going to take?
[00:43:04]
And is right now the right time to spend that much time?
[00:43:06]
On the other hand, if it's like a really small amount of time, it's not really going to be
[00:43:10]
like a big distraction, like, yeah, you can just like, answer it.
[00:43:13]
Or sometimes you can just give a brief answer and say, like, we'll talk about that more
[00:43:17]
later or even just like, ask me about it after the workshop.
[00:43:20]
And we'll all explain it.
[00:43:21]
Like for the number one, for example, if I did put that, so first of all, I'm actually
[00:43:26]
pretty careful in examples.
[00:43:27]
Like, I know I did this in element action in my like workshop slides, but even if I'm
[00:43:31]
just like doing something live, I'll always just choose floats.
[00:43:34]
Like just don't say, like, if I'm making a list, it's never going to be like, one, two,
[00:43:39]
three, it's going to be 1.1, 2.2, 3.3, because yeah, then that just doesn't come up.
[00:43:45]
And it's a little thing, but right, it's like, it can prevent a question, which might lead
[00:43:48]
to a tangent.
[00:43:50]
So it actually helps keep the course focused.
[00:43:53]
And you can do things like that with examples in general, just sort of being like, well,
[00:43:58]
here's what comes first to my mind.
[00:44:00]
But if I do that, like, what are the questions people might ask if they see this?
[00:44:05]
It's like, what have they seen so far?
[00:44:06]
Is this going to show them something new that might lead them to ask a question about it?
[00:44:10]
If I'm not ready to teach that, I can just maybe pick a different example, what's not
[00:44:14]
going to result in their having that question.
[00:44:16]
So for instance, you would try to avoid having the person write HTML message with a lowercase
[00:44:23]
M. Oh, sure.
[00:44:24]
Yeah.
[00:44:25]
Because then they would actually understand that.
[00:44:28]
That's another good example is like, whenever I so, you know, I start with basic syntax,
[00:44:33]
then LM architecture, then like the third, you know, module or chapter, whatever is like
[00:44:36]
types.
[00:44:37]
When I ask people to annotate stuff, even for the static HTML parts of the page, I'll
[00:44:41]
still have them annotated as HTML with a capital M message, even though they don't need to
[00:44:46]
it's overly constrained.
[00:44:48]
But it's fine.
[00:44:49]
Like, I don't need to end like sometimes I'll have a student like, so one thing that'll
[00:44:53]
come up in a workshop is that students will be at different levels.
[00:44:56]
And like some some people, this will be all brand new to them.
[00:44:58]
But some people will be like, oh, they've used like, you know, OCaml before or something
[00:45:02]
like that.
[00:45:03]
And sometimes somebody will raise their hand and be like, Hey, does this need to be HTML
[00:45:07]
message?
[00:45:08]
Or like, can I kind of do like HTML a or something like that?
[00:45:10]
And I'll just be like, Yeah, that'll work too.
[00:45:12]
Right?
[00:45:13]
I just like just try to answer it as fast as possible.
[00:45:15]
Like if this is going to be like, you know, this person knows what I'm talking about.
[00:45:20]
If I if I give them a quick answer, everybody else is going to be lost if I go into a whole
[00:45:24]
digression on it.
[00:45:25]
So I don't want to go on that digression.
[00:45:26]
So I'll just be like, Yes, like I try like one word answers quite often.
[00:45:30]
Like when somebody asks like a question that's like, too advanced for most of the class,
[00:45:35]
I'll just be like, Yes.
[00:45:36]
And you can say we'll get we're gonna get into more detail on that.
[00:45:39]
But you've got the right idea.
[00:45:40]
And they'll get the attention of the other students on this topic.
[00:45:44]
Yeah, well, often I don't even I don't even bother.
[00:45:47]
I'm just sort of like, I don't I don't want to go on the diversion.
[00:45:49]
So my my prioritization is just like, let's just answer the question of other people.
[00:45:54]
Like, I don't really understand the question.
[00:45:55]
But it sounds like the answer is yes.
[00:45:57]
So okay, whatever.
[00:45:58]
Right?
[00:45:59]
Then they don't they don't get pulled away from like the direction I'm trying to teach.
[00:46:03]
You can actually do a lot with your tone as a teacher slash facilitator.
[00:46:07]
If you give quick, upbeat answers short, then people are like, Okay, this is not a detailed
[00:46:14]
discussion that we're diving into.
[00:46:15]
Like if you say like, Yeah, that's right.
[00:46:17]
They're this and that then they're like, Okay, so the last follow up questions, then they're
[00:46:21]
like, Okay, and the next thing is,
[00:46:24]
yeah, that's a great point.
[00:46:27]
Yeah, like, like, I still want to be enthusiastic with my response and not and not, you know,
[00:46:32]
try to like, suggest that there's anything wrong with what they asked, like, totally
[00:46:35]
reasonable thing to ask.
[00:46:36]
Yeah, just just like, yes.
[00:46:37]
Yep.
[00:46:38]
And you've got to stay focused on what is the goal right now.
[00:46:42]
And you know, so like, the goal right now is to teach this topic.
[00:46:46]
And we'll get to that later.
[00:46:47]
So
[00:46:48]
because if you think about it as the alternative, it's like just just imagine in your in your
[00:46:50]
mind like the two different scenarios, one where you just answer quickly and move on.
[00:46:55]
And the other where you're like, let's go in and spend, you know, the amount of time
[00:46:59]
that we could spend on this topic.
[00:47:01]
What's most of the class gonna be doing, they're gonna be like, like, what, is this like a
[00:47:06]
new module we're doing off the cuff now?
[00:47:08]
Like, you know, it's and also like, now you don't have slides prepared or whatever, like
[00:47:12]
to, you know, to back up what you're talking about, and to make you go more smoothly.
[00:47:16]
And yeah, you just end up ad hoc teaching something that, you know, either you were
[00:47:20]
going to teach later, or maybe that you decided, you know, you weren't going to teach in this
[00:47:24]
section at all.
[00:47:26]
And perhaps correctly, worth noting that there's there is a book equivalent of people asking
[00:47:33]
questions that are like more advanced, which is, if you're giving people early drafts to
[00:47:38]
read and give feedback on oftentimes, like people will suggest, like, Hey, are you going
[00:47:44]
to talk about this?
[00:47:45]
Or like, you know, I noticed that you didn't talk about that, I think you should.
[00:47:48]
And oftentimes, what people say is, I think better beginners will be confused by dot dot
[00:47:53]
dot.
[00:47:54]
And, but they're, they're not a beginner anymore.
[00:47:56]
So like, they, they, they might be right, but they also might be wrong.
[00:48:00]
And you have to be really careful about that of like, it's pretty easy to end up with,
[00:48:04]
like, what are the set of things that I should teach in this section?
[00:48:07]
And it's just the union of like, all possible things I could teach, because different people
[00:48:10]
who read it each thought that, like, maybe beginners will be confused by x, y, or z.
[00:48:15]
So there's some aspect of like, the most valuable thing, and this is unfortunate, because, you
[00:48:20]
know, as soon as you teach someone something, they're, it's too late, like, you can't go
[00:48:23]
back and ask them to like, learn it from scratch again, right?
[00:48:26]
Because they already know it.
[00:48:27]
And like, now they're, you know, they're not, so you got to like, try to find new beginners
[00:48:30]
each time.
[00:48:31]
But like, the most valuable feedback is like, getting a group of actual beginners who don't
[00:48:35]
know the material at all, and seeing what they actually are like, confused by in practice.
[00:48:40]
Before I started computer science, I studied piano performance, and my teacher, I mean,
[00:48:46]
studying music performance is one of the best ways to learn about pedagogy, because for
[00:48:51]
one thing, you have like, a master teacher, and hopefully, and then the other thing is,
[00:48:57]
they're working with you one on one, you know, so it's an incredible opportunity to learn
[00:49:01]
how to teach.
[00:49:03]
And my piano teacher was brilliant, and really influenced me outside of music, in addition
[00:49:10]
to within music, about isolating things to the most minimal thing and being very disciplined
[00:49:16]
about that.
[00:49:17]
So like, what are you trying to accomplish right now?
[00:49:19]
And if you're trying to produce the sound a different way in the piano, why are you
[00:49:26]
playing a complex piece with all these fast notes and passages and all these different
[00:49:31]
complex fingerings in the scale passage you're playing?
[00:49:34]
If you're trying to produce a different sound, isolate that and isolate down to that one
[00:49:40]
piece or if you're trying to, you know, so try to minimize the number of different skills
[00:49:46]
that you're exercising at once.
[00:49:48]
And I think having that discipline, and it's, so for example, like, that's one of the reasons
[00:49:55]
why I really love test driven development, because I think it's almost like, I think
[00:50:00]
of it sometimes like a pulley that it allows you to stretch out a large amount of work
[00:50:07]
over a greater distance, so it eases the work you need to put in.
[00:50:12]
And so like, when you're doing test driven development, you, all you're trying to do
[00:50:17]
is get the current test green.
[00:50:20]
You don't want to get distracted by, wait a minute, there's this thing that's wrong
[00:50:23]
right now.
[00:50:24]
Like, no, that's, the test is not telling you to do that.
[00:50:28]
You have one test, you're trying to get it green.
[00:50:30]
Like, yeah, but there's this one corner case.
[00:50:33]
Great.
[00:50:34]
You get the test green, then you get that, then you write a test for that corner case.
[00:50:38]
Now that's your sole focus.
[00:50:40]
And so just being with one thing, having that discipline, isolating it is like, just being
[00:50:48]
disciplined about that will get you a long way, I think.
[00:50:51]
Yeah, it's definitely tough because the temptation is if somebody asks you a question or, you
[00:50:57]
know, a reviewer says like, oh, teach this thing, you know, what about this thing?
[00:51:01]
You're like, oh, I know about that thing.
[00:51:03]
Let me talk about that thing.
[00:51:05]
Right?
[00:51:06]
There's definitely an allure to that.
[00:51:07]
Yeah, you got to be disciplined and not go down that rabbit hole.
[00:51:11]
I'm very curious to know about how you onboard new hires.
[00:51:16]
If you get a new hire, they don't know Elm at all, they know something else.
[00:51:21]
How do you teach them Elm?
[00:51:23]
The way I've always done it is pair programming.
[00:51:25]
Just have them drive, like have them be at the keyboard.
[00:51:29]
And yeah, I mean, in our case, like we have a substantial Elm code base already.
[00:51:33]
So usually just like, you know, pick a feature and have them dive into it and not even start
[00:51:38]
by explaining the Elm architecture necessarily.
[00:51:41]
Maybe just start by being like, okay, here's what's going on on this page.
[00:51:45]
We got this UI, it's doing these things.
[00:51:47]
We want to change this thing to do this.
[00:51:49]
And then just be like, okay, let's start by, here's this thing.
[00:51:52]
Okay, so we got this view function.
[00:51:53]
It says like, you know, view drop down or whatever, view, whatever it is.
[00:51:56]
That's what we're going to be modifying because that's the thing that we want to change.
[00:51:59]
So let's go in there and okay, see, it sees like lists.
[00:52:02]
All right, this is a list.
[00:52:04]
We're calling, here's some function calls.
[00:52:06]
Let's you know, so basically just like going through a similar kind of maybe progression
[00:52:13]
in terms of like what I'm teaching them, but doing it in sort of an ad hoc way in the context
[00:52:17]
of some code.
[00:52:18]
So it's like, all right, let's find the part in the file.
[00:52:20]
I know where it is, you know, that we need to go look, let's go look here.
[00:52:24]
And then I'll just explain the syntax of like, literally what you're looking at, and contextualizing
[00:52:28]
it in terms of the project that we're working on.
[00:52:30]
And obviously, try to start with something that's, you know, pretty minimal, and don't
[00:52:34]
be like, oh, let's pick this next task, which is like rewrite this whole page, that's not
[00:52:37]
going to go great.
[00:52:39]
Something where you're making an incremental change.
[00:52:42]
And then yeah, just be like, okay, here's the syntax of what we're looking at.
[00:52:45]
And then here's the change we want to make, we want to make this function call do something
[00:52:48]
else.
[00:52:49]
And at first, you can sort of, you know, just let them do like copy pasting without necessarily
[00:52:54]
knowing all the details of what they're copy pasting.
[00:52:56]
So you might say, for example, okay, we're going to copy paste this this function declaration
[00:53:01]
up here, and we're going to make a new helper function down below.
[00:53:04]
And we're going to change the the name of it to this, we're going to change the types
[00:53:07]
to this, don't worry about types, we'll come back to that later.
[00:53:10]
And then, you know, just kind of keep them focused on like, okay, I'm making a function
[00:53:13]
that's going to do this thing a little bit differently than what it did before.
[00:53:17]
One thing I like to try and do is to expose them to compiler errors pretty early on.
[00:53:23]
Because once they get comfortable seeing a compiler error, and like, and I'll let them
[00:53:27]
like, look at it, like, I won't try to explain the compiler error, I'll be like, okay, let's
[00:53:31]
do this.
[00:53:32]
And I'll say, that's not going to compile, let's let's go see what the compiler says,
[00:53:35]
and then let them read the error message.
[00:53:37]
And then if they don't get it, then I can explain it.
[00:53:39]
But you know, hopefully more often than not, they will get it.
[00:53:43]
And what's great about that from an onboarding perspective is that then once you're done
[00:53:45]
pairing, you can go away and they can probably keep, you know, some some extent stumbling
[00:53:50]
through some things and just having the compiler help them and like, pretty early on, you switch
[00:53:54]
from like, this person needs a human to help them to like, they're just good with the compiler
[00:53:59]
helping them.
[00:54:00]
And like the only time they need somebody to help them just sort of like get more muscle
[00:54:04]
memory with the language and like get more reps in is when they're trying to do something
[00:54:08]
that's like in a whole category that they've never done before, like ports, you know, they're
[00:54:11]
like, I need to talk to JavaScript, how do I do that?
[00:54:14]
But otherwise, it's just like, yeah, you can, you can let people just sort of like, in my
[00:54:18]
experience, like go off on their own, they'll have some questions now and again, but like,
[00:54:21]
if you get them going on pair programming, and your goal is sort of, I want to get them
[00:54:26]
comfortable with the compiler and like knowing the basic syntax.
[00:54:30]
And then at some point, you probably have to stop and explain the LVAR architecture.
[00:54:34]
But but you don't necessarily have to like give them a thorough understanding of it really,
[00:54:37]
I mean, just being like, here's the rule, if I want to add a new thing here, I'm going
[00:54:40]
to add a thing to this message thing, then add a thing here, and then just follow the
[00:54:44]
compiler errors.
[00:54:45]
And that's it.
[00:54:46]
That'll get people quite a ways.
[00:54:48]
And once they get comfortable with the compiler, the compiler can be an effective, you know,
[00:54:53]
assistant to help them like continue learning on their own.
[00:54:55]
And once they get in the habit of reading the compiler errors, because many people are
[00:55:01]
coming from contexts where error messages are not helpful, they're just something that
[00:55:08]
tells you, okay, be annoyed and buckle up because you're gonna have some pain.
[00:55:13]
Now, please look at your code carefully and try to figure out where the error is.
[00:55:18]
Right.
[00:55:19]
Yes.
[00:55:20]
No, you did bad.
[00:55:22]
Oh, yeah.
[00:55:24]
Try again.
[00:55:25]
It's an antagonistic relationship.
[00:55:28]
Whereas with Elm, like one of the things that our role is to do with people learning Elm
[00:55:35]
is to unlearn that behavior to have an antagonistic relationship with the compiler, but to actually
[00:55:42]
embrace the help that it gives you because it will help you if you read the messages.
[00:55:47]
But I remember being in the habit of not looking at error messages because I'm just like, oh,
[00:55:53]
annoying red stuff that tells me I'm having a bad time right now.
[00:55:57]
Yeah, yeah, I've been there.
[00:56:01]
Yeah.
[00:56:02]
So what is their next step?
[00:56:05]
When they get comfortable, you have not explained the Elm architecture, they have not explained
[00:56:10]
some concepts that you may see pretty early on in the Elm guide, for instance, or in Elm
[00:56:15]
in action.
[00:56:16]
What do you recommend them to get further learning on the topics?
[00:56:22]
So always start with the Elm guide because it's, number one, it's free, which is great.
[00:56:27]
And number two, it's...
[00:56:28]
Before the pairing?
[00:56:29]
Oh, no, no, no.
[00:56:30]
Like after the pairing.
[00:56:31]
Yeah, yeah.
[00:56:32]
And then once they've gotten the basics, and I think part of that is, A, just giving them
[00:56:36]
the confidence of, hey, I can build stuff in this code base and not feel like they need
[00:56:41]
to go do a bunch of examples before they understand anything.
[00:56:47]
To be fair, different people learn in different ways.
[00:56:49]
Some people will tell me, I don't want to get into the code until I've read something,
[00:56:53]
what should I read first?
[00:56:54]
In which case, great.
[00:56:55]
I have them start with the guide.
[00:56:57]
But one nice thing about the guide is that because it's pretty light reading, it's not
[00:57:06]
like a big time investment to go through it.
[00:57:08]
Like Elm in action is like a whole book with multiple chapters and stuff, whereas the guide's
[00:57:12]
like...
[00:57:13]
I mean, it's got chapters, but they're way shorter.
[00:57:14]
So you don't need to ask someone to make as big of a time investment.
[00:57:20]
The other thing is that I think when someone's reading the guide and they've already had
[00:57:23]
a little bit of experience with the language, they can have this experience of like, okay,
[00:57:27]
I don't need to do all these examples.
[00:57:29]
I already know the syntax well enough.
[00:57:31]
I can just look at these things and just pick up details.
[00:57:33]
Like, oh, I know there's this thing called view and there's this thing called message,
[00:57:38]
and I don't really know how they relate.
[00:57:41]
You see the diagram, you're like, got it.
[00:57:43]
Okay.
[00:57:44]
Now the pieces are coming together of the stuff that I was doing without fully understanding
[00:57:49]
it.
[00:57:50]
Now I understand it more fully.
[00:57:51]
I get the concept and not just the...
[00:57:54]
There's this rule where whenever I want to add a new event handler, I put it in this
[00:57:58]
message thing.
[00:57:59]
I get why.
[00:58:00]
So that is definitely a...
[00:58:03]
It's a different path from somebody who's like, I want to learn this language.
[00:58:08]
I want to come in and just read through a thing that by the end of this, I will know
[00:58:11]
how to make things in this language.
[00:58:13]
But the nice thing about doing the starting people off with pairing at work is that hopefully
[00:58:19]
they can get a lot of that motivation just like from the hands on experience.
[00:58:25]
Even if they don't understand what's going on or why, they can get some of those moments
[00:58:29]
of like, oh, I didn't even know what I was doing and the compiler really helped me out
[00:58:33]
a lot.
[00:58:34]
I want to learn more.
[00:58:36]
I want to do more of this.
[00:58:37]
Because one thing to keep in mind is that if you're teaching a coworker, to me, it's
[00:58:42]
kind of a safe assumption that your coworker isn't already an Elm fan.
[00:58:46]
Because how do you become a fan of Elm by using it?
[00:58:50]
So if you have to teach them, that implies that they haven't used it before, which means
[00:58:55]
that you do still have that motivation step of like, why should they bother going through?
[00:59:00]
Even the guide's a lot shorter than Elm in action or a workshop or something.
[00:59:04]
But it's still not a blog post.
[00:59:06]
I mean, it's a bunch of stuff to go through.
[00:59:09]
Why should they care?
[00:59:10]
And also, why should they not just skim it and just be like, yeah, yeah, okay, it's architecture
[00:59:16]
or whatever.
[00:59:17]
And I think the answer is give them a taste of it first.
[00:59:21]
So if you can, if you're in that sort of coworker situation, yeah, start by giving them a taste.
[00:59:26]
So you mentioned the hardest things to teach in Elm that Signals was the notorious big
[00:59:33]
one for a while.
[00:59:35]
And I think I heard maybe on Elmtown once, I can't remember if it was Evan or maybe
[00:59:41]
you talking about how teaching those workshops and your feedback from students in those influenced
[00:59:49]
the language design, which I thought was really cool.
[00:59:52]
That's very, it could have been me.
[00:59:54]
What are the hardest things to teach now?
[00:59:57]
Maybe we've covered some of them.
[00:59:58]
So there's two that stand out above everything else.
[01:00:01]
And my prediction is I would actually like for you guys to guess because I'm really curious
[01:00:05]
to see if you can guess what they are.
[01:00:07]
Well, at least what I consider them to be based on my experiences.
[01:00:09]
I'm not trying to say this is universal, but my prediction is that both of you will guess
[01:00:14]
one of them correctly and guess the other one incorrectly.
[01:00:16]
Okay.
[01:00:17]
This is a good challenge.
[01:00:18]
By the way, I'll mention that it's not syntactic.
[01:00:22]
One of the things that's hard for beginners to pick up is where the parentheses go.
[01:00:25]
It's not hard to teach.
[01:00:27]
It's just like you teach it and people are like, got it.
[01:00:28]
And then they go to do the exercise and they're like, I messed up my parentheses because I
[01:00:32]
tried to call it like JavaScript style where the parentheses touch the function.
[01:00:35]
Anyway.
[01:00:36]
So it invokes something as if passing in a single argument is invoked with parentheses
[01:00:42]
and it works because it's a single argument function and then maybe on format fixes and
[01:00:48]
they're like, all right, this is that.
[01:00:49]
Yeah, that can't happen.
[01:00:50]
Yeah.
[01:00:51]
But what I found is that people get the parents think like by the end of the day, they just
[01:00:54]
like, yeah, they just figured that out.
[01:00:56]
But anyway, it's not that.
[01:00:57]
So two things, I'm just curious what your guesses are.
[01:01:00]
I'm guessing it's currying for one of them.
[01:01:03]
Oh, that's a good guess.
[01:01:05]
But only because I've watched one of your talks when you mentioned that currying was
[01:01:09]
one of the hardest concepts to explain.
[01:01:11]
Okay.
[01:01:12]
It's a very good guess.
[01:01:14]
I want to say immutability would be one thing too.
[01:01:17]
You don't think so?
[01:01:18]
I mean, the one that people most complain about is JSON decoders, but I don't know
[01:01:26]
if that's the one that Richard would say it is.
[01:01:30]
I don't think it is.
[01:01:31]
That's what the guess is you're in.
[01:01:32]
Nice.
[01:01:33]
Are you saying I wouldn't say that just because I made JSON decode pipeline or for a different
[01:01:38]
reason?
[01:01:39]
I think I'm going to be surprised.
[01:01:43]
And JSON decoding is a different mindset because people are used to just working with JavaScript
[01:01:49]
object notation from JavaScript where you just are like dot this, dot this, dot this.
[01:01:56]
And not validating.
[01:01:57]
Exactly.
[01:01:58]
I don't know.
[01:01:59]
It's probably right.
[01:02:00]
Yep.
[01:02:01]
Yeah.
[01:02:02]
All right.
[01:02:03]
So, I think that's the answers.
[01:02:04]
Or didn't do you want to guess?
[01:02:05]
Well, the Elm architecture was the other thing that came to mind, but I mean, it's just a
[01:02:09]
more, it's a broader topic in Elm, but I'm not sure it's an unintuitive one.
[01:02:13]
I think it's intuitive.
[01:02:14]
So, I don't know.
[01:02:15]
What are they, Richard?
[01:02:16]
Yeah.
[01:02:17]
Yeah.
[01:02:18]
Jeroen got them both right.
[01:02:19]
Wow.
[01:02:20]
Yay.
[01:02:21]
JSON decoders and currying.
[01:02:22]
Yeah.
[01:02:23]
I thought that I didn't realize that I'd talked about currying being hard because I would
[01:02:26]
not have guessed that one.
[01:02:27]
I would not either.
[01:02:29]
Okay.
[01:02:30]
Yeah.
[01:02:31]
It was surprising to me when you mentioned that in your talk.
[01:02:33]
I wonder if any new programming language designs will be influenced by this.
[01:02:39]
Who knows?
[01:02:41]
Who could possibly say?
[01:02:45]
So the thing about currying that's tricky is that, so first of all, what I've observed
[01:02:50]
is that I've refined my explanation of it in a couple of different times, but I have
[01:02:54]
not been able to break through this ceiling of just, as I'm explaining it, people understand
[01:03:00]
each individual step.
[01:03:01]
I'm like, okay, so I got this whole thing where I go through, let's take a function
[01:03:05]
that has three arguments.
[01:03:06]
I think pluralize is usually the one I use.
[01:03:10]
Then I'm like, cool.
[01:03:11]
Now let's, we know about partial, so actually partial application for some reason seems
[01:03:15]
to be easier to explain than the types involved in currying.
[01:03:19]
If I just say, hey, if I call this function, I can leave off the last argument.
[01:03:23]
When I get back as a function that takes that argument and so forth, they're like, okay,
[01:03:27]
got it.
[01:03:28]
As soon as I start turning that into types, that's where it gets hard is it's like, okay,
[01:03:32]
so the type of this function is like this arrow, this arrow, this arrow, this, and then
[01:03:36]
people are like, why?
[01:03:37]
Like that's weird.
[01:03:39]
Like that's not, no, this is like, that's for returns, not for arguments.
[01:03:43]
Like, okay, bear with me.
[01:03:44]
Let me show you why it's actually the same.
[01:03:46]
And so I worked my way up and I say like, here's pluralize and we agree that if I call
[01:03:50]
pluralize with one argument removed, it gives me back a function that takes an argument
[01:03:56]
and then yes, we agree.
[01:03:58]
All right, now let's try it with two arguments.
[01:04:00]
Okay.
[01:04:01]
And then I just, I worked my way up and then basically just break it all the way down and
[01:04:05]
then show how like, and then build it back up and be like, well, if this is the type,
[01:04:09]
then clearly it's like this, like, but with, you know, the parentheses around the arrows
[01:04:13]
and then I'm like, and then at the end I'm like, finally like, okay, and then you don't
[01:04:16]
need to put the parentheses in.
[01:04:17]
So I just take all the parentheses out and I'm like, ta da.
[01:04:21]
The problem is that even though each individual step makes sense at the end, I look at like
[01:04:26]
the expressions on students face and they're kind of like, yeah, but they're still arrows.
[01:04:33]
Like you know, it's like, but that's still for returns.
[01:04:36]
And so it ends up being one of those things where people are sort of like, I believe you,
[01:04:42]
I don't, I feel like I must be missing something, but like, I'm just going to trust you like
[01:04:47]
whatever, they're arrows.
[01:04:48]
Okay, got it.
[01:04:49]
And so they get by, like, it's not like they're, they're so lost that like, they can't, they're
[01:04:54]
blocked like the, the, but they don't get it right.
[01:04:57]
Like the, the, the, like actually, and when I say they, I don't mean like every single
[01:05:01]
student, it's just like a lot of students, like maybe like half the class.
[01:05:04]
And I just like, every time I do a workshop, I'm like, all right, here we go.
[01:05:07]
It's time to teach currying.
[01:05:08]
I know what's going to happen.
[01:05:09]
Like half the people, I'm like, some of the people are like, that's so cool.
[01:05:13]
And that's like really cool.
[01:05:14]
But for most of them, it's, it's just like, they're just like, okay.
[01:05:18]
And it's, it's always like a low point in the workshop for me because like, I'm just
[01:05:22]
like, I, I'm teaching types and especially because it has to come so early because as
[01:05:27]
soon as like, I'm actually very careful to teach only single argument functions when
[01:05:31]
I'm teaching types like at first.
[01:05:33]
And then like, because as soon as I get to a multi argument function and in the type
[01:05:37]
section, I have to introduce currying because otherwise it just doesn't, you know, like
[01:05:41]
I, I, I, maybe I should try this as like, try to get through the entire workshop with
[01:05:45]
just hand waving away the arrows and just be like, yeah, it's weird.
[01:05:49]
That's just the syntax.
[01:05:50]
Funny, huh?
[01:05:51]
Anyway, moving on.
[01:05:52]
That's like, that's a defensible way to teach it.
[01:05:55]
But I, I don't know, maybe because I've always felt like, oh, this is, I just want to teach
[01:06:00]
currying, you know, I don't, I don't want to like have someone leave an eight hour beginner
[01:06:04]
workshop without knowing why the types are that way.
[01:06:07]
Cause it actually is really cool.
[01:06:08]
Like it's, it's genuinely like a very cool thing, I think.
[01:06:11]
But I just, I've never been able to crack it where, where people actually end that section,
[01:06:15]
like feeling like happy, confident, you know, whatever.
[01:06:18]
They're just like a bunch of them are just like, eh, what?
[01:06:22]
Okay, whatever.
[01:06:23]
Fine.
[01:06:24]
You know, like grudging acceptance of like, this seems, it seems like there's a reason
[01:06:28]
for this.
[01:06:29]
I don't really understand it, but like, you seem to know what you're talking about, so
[01:06:32]
I'm going to go with it.
[01:06:33]
Let's move on.
[01:06:34]
So that's that.
[01:06:35]
And then JSON decoders are just hard, I think.
[01:06:40]
It's funny because I don't feel like I've had trouble explaining currying, but explaining
[01:06:45]
the motivation for partial application that I can't get it across.
[01:06:51]
Like, Oh, why would, why, why would you want to have a add five and make that a function?
[01:06:57]
Oh yeah.
[01:06:58]
Yeah.
[01:06:59]
But that's probably not the best example.
[01:07:01]
And maybe I just need to find a better one, but that's where I get stuck.
[01:07:05]
I remember the example from Elm in action.
[01:07:08]
I actually remember there was something with like list dot map, which was a very good example.
[01:07:15]
And it was like, all right, let's, we give list dot map a function to apply for each
[01:07:20]
item.
[01:07:21]
So, you know, maybe it's like anonymous function with an argument string, and then it returns
[01:07:27]
string dot two upper on each string.
[01:07:31]
And then it's like, actually, did you know there's a cleaner way to write this?
[01:07:35]
You can remove that argument in the anonymous function and then remove it from where it's
[01:07:41]
defined in the parameter and then remove it where it's passed in.
[01:07:44]
It's actually the same because of partial application.
[01:07:46]
Well, that way you don't even need partial application, right?
[01:07:49]
Cause like string dot two upper just takes one argument.
[01:07:51]
So I'll usually, that's true.
[01:07:53]
That's not exactly the same thing.
[01:07:54]
Yeah.
[01:07:55]
Well, but I'll start with an example like that.
[01:07:56]
I like doing that.
[01:07:57]
And then like a one argument thing, and then it'd be like, check it out.
[01:08:00]
It also works like a two argument function.
[01:08:01]
You just like leave out the second one.
[01:08:03]
So I admit it's not the strongest motivation.
[01:08:06]
I mean, like, you know, without going on a tangent about that, I mean, like I, my feeling
[01:08:12]
is that that's the main use case for partial application.
[01:08:15]
I know it's just like being a little bit more concise when you're using a higher order function.
[01:08:20]
Like that's, that's kind of it.
[01:08:21]
Separately you could go on a whole thing about like the pipe operator, like that works because
[01:08:26]
of partial application or at least the way that it works in L works that way.
[01:08:30]
Like Elixir and you know, other languages do it differently.
[01:08:33]
But the interesting thing to me is that well, an interesting thing to me is that if you
[01:08:40]
want to, you can go on like, well, this allows a lot of point free function composition.
[01:08:45]
Like if you don't have currying, it's a lot harder to do like point free function composition.
[01:08:49]
The thing is, I don't think point free function composition is a great idea in the general
[01:08:53]
case.
[01:08:54]
And I kind of try to discourage it.
[01:08:56]
I actually periodically, I'm not kidding.
[01:08:58]
I forget that Elm has the like less than, less than, and greater than greater than operators.
[01:09:02]
Cause I just never use that.
[01:09:03]
Like literally never use them.
[01:09:04]
I just, I just pretend that they're not in the language.
[01:09:07]
And then I periodically remember that they're there like, oh yeah, I forgot about those.
[01:09:11]
I tried to do that too, because it always like hurts my brain just a little bit more
[01:09:16]
than it needs to at the cost of not declaring an anonymous function with an argument.
[01:09:23]
Yeah.
[01:09:24]
It's like just, it really doesn't save you.
[01:09:28]
It doesn't save you much.
[01:09:29]
It's going to hurt people's brains more.
[01:09:32]
And the second you need to like do something a little more nuanced where you need to like
[01:09:37]
add a let binding in there or whatever you need to do.
[01:09:40]
You can't do that.
[01:09:41]
You need to change to Lambda anyway.
[01:09:43]
For me, it's not even for other people.
[01:09:44]
It's for me.
[01:09:45]
Like when I, when I used to use it and I'd come back to code that I'd written in that
[01:09:49]
style, I'd just be like, what does this do again?
[01:09:51]
Let me just like inline the Lambda.
[01:09:53]
Okay.
[01:09:54]
Now I get it.
[01:09:55]
And I was just like, why don't I just save myself the trouble and just write it that
[01:09:56]
way in the first place.
[01:09:57]
Yeah.
[01:09:58]
It's weird because it's only a few characters different.
[01:10:01]
So yeah.
[01:10:02]
And one is so much harder to understand than the other one is weird.
[01:10:06]
Point free function application, like with the pipe operator, big fan.
[01:10:11]
Right.
[01:10:12]
Often I find it easier to read.
[01:10:14]
And you know, I don't know, I don't know exactly why that is.
[01:10:16]
Like you would think that like, I don't know, my brain or like, but also I, again, this
[01:10:20]
seems like one of those things where I don't think I'm weird in that regard.
[01:10:22]
I think most people are, seem to be that way in terms of what they find easier to understand
[01:10:26]
when they're reading it.
[01:10:28]
Another quirk in, you know, that people have learning Elm is, I mean, Elm is a relatively
[01:10:34]
small language.
[01:10:36]
Like the syntax is not that large compared to many languages.
[01:10:40]
And there aren't that many special cases of what things do, different ways of writing
[01:10:43]
things.
[01:10:44]
But one thing that can trip people up is, you know, the constructor functions for variants.
[01:10:50]
So some, so you define, you know, type user equals admin with a record and, you know,
[01:10:58]
or you define a type alias user is a record with first name, last name.
[01:11:04]
And now wait a minute, is it a function or is it a type?
[01:11:09]
And it's both in the case, if it's type alias, it's both.
[01:11:13]
If it's a custom type, then there are things that live in two different spaces.
[01:11:17]
There's the type space, which you can use user, and there's the value space, bodies
[01:11:23]
of functions and stuff where you can use admin, but not vice versa.
[01:11:27]
And so Joël, how do you pronounce his name?
[01:11:32]
Jeroen Keneville?
[01:11:33]
Keneville?
[01:11:34]
Yeah.
[01:11:35]
Jeroen is my French translator.
[01:11:41]
But he's very deliberate also about teaching, and he was telling me that he sometimes introduces,
[01:11:51]
like, you know, if you're doing like a JSON decode pipeline and you start with like a
[01:11:56]
type constructor, he'll sometimes start with just an anonymous function that takes first
[01:12:01]
name and last name and creates a record.
[01:12:03]
Sure.
[01:12:04]
Yeah.
[01:12:05]
Because it's just a confu-, and then he says, oh, you know what?
[01:12:08]
This is a little verbose, isn't it?
[01:12:09]
It would be nice if there was a shorthand for this, right?
[01:12:12]
So that's introducing that motivation.
[01:12:14]
And yeah, I really like that approach of, I think, I think this is a really good takeaway
[01:12:21]
for me and hopefully people trying to introduce people to Elm is don't be afraid to show a
[01:12:27]
non idiomatic way to do something, because it allows you to introduce fewer concepts
[01:12:33]
at once.
[01:12:34]
And then it actually gives you the opportunity to give motivation when you do introduce that
[01:12:39]
cool idiomatic technique.
[01:12:40]
So it's actually going to, to end up sitting in their brains better as a result, because
[01:12:46]
you gave them the motivation by teaching them the non idiomatic way first.
[01:12:51]
Yeah, that's exactly how I do it when I'm teaching JSON decoders and like the record
[01:12:54]
constructor thing is like, I'll first just make a, I'll actually use a named function.
[01:12:58]
I'll name it like, you know, make user or something, and it just does that.
[01:13:02]
And then I think it's like, usually it's the very last step.
[01:13:05]
It's like after I do the whole thing, I'm like, and also, by the way, you don't need
[01:13:08]
to write this make user function by hand.
[01:13:09]
You can just say user, and then that'll save you a little bit of time.
[01:13:14]
But the hard part is teaching the stuff leading up to that anyway.
[01:13:16]
So right, right.
[01:13:17]
And if you start with the motivation to like, I really enjoyed the Elm radio episode that
[01:13:22]
Yaron and I did about JSON decoders, because I think the podcast format is just a really
[01:13:27]
good format to talk about motivation.
[01:13:29]
And we could really dive into why, like, not so much how do you do JSON decoders, because
[01:13:34]
that part is actually not that hard.
[01:13:38]
What's hard is understanding, yeah, but why?
[01:13:40]
Why can't I just get the data?
[01:13:43]
And if once you understand that the rest of it makes sense.
[01:13:45]
Yeah, I, the thing that I find hard about it in a beginner workshop is specifically that
[01:13:50]
it's a lot of like higher order functions.
[01:13:53]
And it's a lot of concepts that people haven't seen before.
[01:13:56]
Like even if you try to do like the, like, you can start with not doing like JSON decode
[01:14:00]
pipeline, but starting with just like, you know, map two, map three, whatever for like
[01:14:04]
the object.
[01:14:05]
But like if you're doing JSON decoding, you're really gotta have records in there.
[01:14:09]
Like that's, I mean, like you could just be like, okay, we're getting a JSON payload from
[01:14:13]
the server.
[01:14:14]
It's a string.
[01:14:15]
That's it.
[01:14:16]
You know, and like, you can do that, but people are like, okay, but what about a real JSON
[01:14:19]
payload?
[01:14:20]
Like the ones that we always see, it's like, it's always a bunch of like nested data structures.
[01:14:24]
And so you have to get into these, like, it's just a bunch of concepts all at once.
[01:14:30]
If you want to try and teach them the full, like, you know, parser combinators style of
[01:14:34]
like higher order functions and like how they compose together.
[01:14:38]
And it's just a lot like to try and like hit someone with all at once, especially in comparison,
[01:14:43]
like you said, to, you know, if they're, especially if they're used to just JavaScript and they're
[01:14:47]
not validating anything, they're just like, what about just JSON dot parse?
[01:14:50]
How about that?
[01:14:51]
Like, you know, so it's like a lot of concepts and it's a lot of advanced concepts.
[01:14:56]
And it's like, I mean, even with the motivation, it's just like the gap is so big that it's
[01:15:01]
just, yeah, it's just not a great spot.
[01:15:04]
Yeah.
[01:15:05]
That's also the part of it.
[01:15:06]
The compiler can't help you 100% all the way.
[01:15:09]
Like if you say decode dot field X and you make a typo, like, yeah, the compiler will
[01:15:16]
won't tell you, you will notice at runtime and the error is not all that great either.
[01:15:21]
Well, I think, so I actually really like, are you two familiar with cones or coins,
[01:15:28]
these little tests, you know, it's, there's like a small unit test suite and you gradually
[01:15:34]
get one by one passing and they're very simple examples.
[01:15:39]
And so people use them to like learn a language.
[01:15:41]
I created a little project.
[01:15:43]
I don't know if anyone uses it, but it's like a little, um, JSON decoders cones.
[01:15:48]
And I actually think it's a very good format for learning JSON decoders because you do,
[01:15:53]
you know, Hey, here's a string.
[01:15:55]
How do you do that?
[01:15:56]
JSON decode string.
[01:15:57]
Oh, it decodes.
[01:15:58]
Well, what if you wanted to decode an integer?
[01:16:01]
Okay.
[01:16:02]
JSON decode in.
[01:16:03]
What if it might be no, and then, you know, you can, that sounds great.
[01:16:07]
Yeah.
[01:16:08]
And it's like, Oh, so you can piece together two decoders and then you gradually see it
[01:16:12]
building up in complexity.
[01:16:13]
So, I mean, it's sort of that idea of the, uh, what's it called?
[01:16:18]
The gradual release of responsibility.
[01:16:20]
You bring that up in, in your Elm conf talk, but there's this pedagogical idea of not flooding
[01:16:26]
every concept at once and having things that incrementally build off of each other.
[01:16:31]
And so I think cones are a very good format for that.
[01:16:34]
I totally agree.
[01:16:35]
That sounds great.
[01:16:36]
Yeah.
[01:16:37]
I mean, I think really the, if I could sum up what's, what's, what makes it hard to teach
[01:16:40]
them in like an intro course or an intro book, it's just that the amount of like you want
[01:16:46]
to do almost a mini course on it, you know, like building up just like, let's start with
[01:16:50]
a small one.
[01:16:51]
Let's make a little bigger, a little bigger because there's just so many little variations
[01:16:55]
of things and yeah, but you don't really want to have like three chapters worth of JSON
[01:17:01]
thing.
[01:17:02]
Yeah.
[01:17:03]
Yeah.
[01:17:04]
Like one JSON chapter.
[01:17:05]
And that's right.
[01:17:06]
Cause otherwise it's just, it really takes the pace like really way off course of the
[01:17:10]
whole course.
[01:17:11]
So, right.
[01:17:12]
Brian Hicks actually has like a nice, uh, Jason decoding handbook, which I'll link to
[01:17:18]
as well.
[01:17:19]
That's like a nice little guide if anyone wants to do a deep dive on that.
[01:17:22]
But, um, but yeah, well Richard, I think we could like talk with you for hours just about
[01:17:28]
this one topic and there's like so much more we want to talk with you about.
[01:17:33]
Thank you so much for coming on.
[01:17:35]
Yeah.
[01:17:36]
Is there anything you want to share with people?
[01:17:37]
We mentioned Elm in action.
[01:17:39]
Are there Elm jobs at no red ink right now?
[01:17:42]
Yes, we are totally hiring.
[01:17:43]
Awesome.
[01:17:44]
And I can't believe I didn't find a way to work that into the conversation already.
[01:17:49]
We're we're I, yeah, it's wow.
[01:17:53]
Um, but since you mentioned it, uh, we're, we're hiring.
[01:17:58]
We use like Elm on the front end and increasingly Haskell on the back end.
[01:18:02]
Um, and we use Haskell in an Elm like style.
[01:18:04]
Like we, we, we call it like Elm flavored Haskell where we basically try to use Haskell
[01:18:08]
in as Elm like a way as we can.
[01:18:10]
We actually even ported over a bunch of the Elm standard libraries stuff to like Haskell
[01:18:14]
like HTTP and basics and stuff.
[01:18:16]
Um, and Elm test also, that's like our testing libraries, like Elm test ported to Haskell.
[01:18:22]
Anyway, um, we're big fans of Elm.
[01:18:23]
Uh, and yes, we have, I think still that we still have the biggest Elm code base that
[01:18:28]
I know of because you know, ours keeps getting bigger, but I know some, there's definitely
[01:18:32]
multiple, you know, hundreds of thousands of line Elm code bases out there, but I think
[01:18:36]
we're, ours is still the biggest, like close to half a million could be wrong.
[01:18:40]
Eurinia is doing his best to catch it up.
[01:18:42]
Yeah.
[01:18:43]
Turn that number down.
[01:18:44]
Yeah.
[01:18:45]
Oh yeah.
[01:18:46]
Yeah.
[01:18:47]
Trying to delete.
[01:18:48]
I mean, deleting stuff is great.
[01:18:49]
Don't get me wrong.
[01:18:50]
Yes, we are hiring.
[01:18:51]
Uh, so no red inc.com slash jobs.
[01:18:55]
Awesome.
[01:18:56]
And um, yeah, for anyone who hasn't done Richard's, uh, advanced Elm course on frontend masters,
[01:19:02]
definitely check that out.
[01:19:04]
If uh, if you're trying to point a newcomer to a resource, the intro course is excellent.
[01:19:08]
Yeah.
[01:19:09]
We could do a whole podcast episode about that type stuff.
[01:19:11]
I know there's, we, we didn't get into it, but I, you've got so many, so many great nuggets.
[01:19:17]
I, we should have just a Richard's nuggets, Richard's Elm nuggets episode just of all
[01:19:23]
the hidden gems you've got for these little Elm tricks.
[01:19:25]
Are these like chicken nuggets or like what?
[01:19:27]
Well, that sounds good.
[01:19:30]
Yeah.
[01:19:31]
I'd love to come back.
[01:19:34]
Yeah.
[01:19:35]
Well, thanks so much for coming on Richard and, uh, you're in until next time.
[01:19:40]
Until next time.