Teaching the basics and beyond

How do you teach Elm to complete beginners? To kids? To bootcamps that are on a track to start a career in programming?

I’ve read quite a few resources, having learned Lisp through How To Design Programs, and Elm through Elm in Action. I’ve taught kids Python with Code Combat and Ozaria — originally I learned Python through Codecademy. And still, I’m only good at an educational level and very small apps! I’m a hobbyist, not a professional.

So all that said, I think nothing beats a good structured book (ideally with a mentor) such as the Head First Series, making a notes file (like a little book) as you go, some code example files, and adding some material to Anki for revision. Documentation in Elm isn’t as good as it could be (not enough examples), but that too.

In my experience, Elm in Action is a great book to begin with, but when it hits Part 3 (Building Bigger) I’m thoroughly confused, and I expect many students will be too. Recursive types and routing is quite difficult, as is larger, nested encoding/decoding json, and the bigger your applications get the harder they become to disentangle and understand. Small apps good, big apps … not so good. At the larger scale, I think it’s better to be working with a professional mentor or understanding company.

So here’s my question for the community:

  1. What would you teach to a kid? What would you leave out? Would you use a different language, such as Bootcamp? (there’s a difference between an 8 year old and a 16 year old, and Bootcamp probably suits the younger kids).
  2. What would you teach to bootcamp early career starters, who may or may not have done a CompSci degree? (I wish I’d started with How To Design Programs, as it’s a great base for programming)
  3. What tools and resources have you (or would you) use for these two cohorts?

I’m hoping in later iterations of Elm Lang some things are made easier, or at the very least explained in a thorough enough way. I think there needs to be it’s own version of How To Design Programs if it’s planning on being an educational tool for functional programming.

What do you all think?

There’s a few posts in here from @johan @Janiczek and @tomka on education, some are tools, some are resources — here’s the links:

There’s many ways to teach, but functional programming is especially hard to explain. The language is often incredibly academic sounding!

There was a session at Elm Camp on Tuesday about education. I unfortunately didn’t write down any links to share. Hoping someone else from that session will chime in as well.

My brief takeaway from the session and my own experience is Elm is good for teaching anyone of any age/education level. People are using it to teach very young children and at universities. We mostly need more sharing of how to teach programming in general (see Felienne Hermans and http://hedycode.com/ for more on this general topic).

Separately @RyanNHG has a brand new series on YouTube that might cover some of this https://youtube.com/playlist?list=PLuGpJqnV9DXq_ItwwUoJOGk_uCr72Yvzb&si=q5MtolBqYU8PGnaj


I’ve started my kids (9 and 8 yo) on Elm using elm-playground to draw simple pictures. So far they are loving it, but we haven’t gotten far on structure yet. I underestimated how much difficulty text-editing skills are going to cause them so my lessons are going a bit slower than anticipated. But my main goal is to make a very fast feedback loop (graphics programming is great for that) and only teach formal structures as they naturally encounter them.

Oh that’s a shame. I think you’re right about teaching the basics in Elm, but I’m not so sure which things should be left out at an early age. Bootstrap: Algebra teaches basic types but I don’t think it teaches Typed programming in the way Elm expects. Type signatures take a lot of explaining, so perhaps leaving that out is better for kids.

I have her The Programmers Brain book knocking around somewhere, but haven’t read it yet. Hedy seems an interesting (and ambitious) project, although I’m not sure it’s a good idea to cater for every single language! Elm’s compiler seems better for discovering the language through error (at least as levels increase)

Hedy has a rudimentary stepper, which is a nice touch. That’s something Elm should have. I guess Hedy is still a work-in-progress. Have you had time to play around with it at all?


Are you using the Playground package? There doesn’t seem to be much documentation for that. What specifically are they struggling with for text-editing?

Racket has a very nice images teach pack, which can be used with what they call Universe to build little games with a Model View Controller, not too dissimilar to Elm architecture.

There’s really a lot of thought and time gone into Racket’s teachpacks, but besides simple pictures I think it suits ages 16 and above. It’s still quite academic. Bootstrap: Algebra and it’s other courses (see above) would be better for younger kids.

The other problem I’ve found with HTDP’s method is that for younger minds, it seems like a lot of code for not much fun. I previewed a simple UFO landing for 15 year olds. They weren’t super impressed. Impressed about the code, but not about the output, when you’ve got so much visual stimulation these days!

Career starters

So there’s some ideas for kids there, but how to you onboard staff? Junior programmers? How do you feel about these coding Bootcamps for adults and how well do you think they prepare you for real projects?

Some might know how to code, some have no experience.

I’ve on boarded boot camp graduates a few times and it varies quite a lot. Some are able to catch on quick and be productive, while others really struggle.

Rob, who led the session on education, mentioned not introducing types till much later. Not sure what advice to give beyond that.

Hmm. That’s interesting. Do you know if those who are productive had more experience before the Bootcamp? Do you think the people who struggle is a failing of the Bootcamp itself? 13 weeks for a full stack is a really short deadline!

I’d agree with Rob on types. You’ll discover them through the compiler (and errors) so gradual introduction, starting with simple ones, makes sense to me.

In the workshops I start out using the Playground, explaining lists (such as a grocery list, or ingredients for a recipe), that your code needs to import the library of shapes (Playground) and that everything outputs to main.
In the process of getting from main = picture [ shape1, shape2.. ] to

main = animation view
view time = ...using time..

the concept of functions is naturally near. I explain functions as little machines that take things and output things and illustrate that with an animation (made in Playground so they can dissect everything).
We encounter situations described as “We throw this shape into rotate (using the pipe) so it can turn it” and “Animation has movement and movement needs time, so we need to throw that in somehow :smiley:

During the course of the workshop series I keep listening to what topics they find interesting and keep teasing them with pieces of hopefully inspiring code that might go over their heads, but have at least some well recognizable parts they can edit/hack/tinker with (didn’t even shy away from elm-physics :stuck_out_tongue:) - they might realize how powerful the tool under their hands is, and that they understand part of it, and that their wielding power might increase by learning more about it.

Where they would encounter types differs; in the current course we found out (because of errors) about the difference between integer and floats, and in a previous series a squirrel would be able to look in different directions by moving its eye (in sideview):

look direction =
  case direction of
    Down -> move 5 -5
    Up -> move 5 5
    Forward -> move 5 0

I’d like to post more, but need to code some teasers for them at this moment; always running out of time, always enjoying it :wink:


I started a project with that in mind: what if my first programming language ever was Elm when I was a teenager?

I got stuck after 10 lessons, using Elm Playground.

Right now I’m learning how to develop simple games with Elm myself to later get back to this project.

The website is currently in Brazilian Portuguese only: https://elm.dev.br and the source (MIT license) is available here: GitHub - marciofrayze/elm.dev.br: Código fonte do site elm.dev.br


I’m bumping this to keep it open and will get back to reply properly tomorrow! I found Elm Playground quite fun until I got to grouping things and trying to animate them. @marciofrayze this looks nice … I’ll have to translate and read it!

1 Like