DEV Community

Cover image for Elm Silent Teacher - An Interactive Way to Learn Elm
Michael Rätzel
Michael Rätzel

Posted on • Originally published at xn--michaelrtzel-ncb.com

Elm Silent Teacher - An Interactive Way to Learn Elm

Originally published at https://michaelrätzel.com/blog/elm-silent-teacher-an-interactive-way-to-learn-elm


Let me introduce Elm Silent Teacher, an educational game designed to help you learn the Elm programming language through interactive exercises.

As I assist beginners in getting started with Elm, I often wonder how we can make learning this programming language easier. This way, I also discovered the 'Silent Teacher' shared by Martin Janiczek at https://discourse.elm-lang.org/t/silent-teacher-a-game-to-teach-basics-of-programming/1490

These compact, interactive learning experiences are an excellent resource for students, so I expanded on the approach and developed it further.

The core loop - learning through bite-sized exercises

In the core interaction loop, the app presents an Elm expression and prompts us to evaluate it.
Of course, evaluating an expression in our brain requires some knowledge of the programming language. So we enter our best guess and initially often get it wrong.
After submitting an answer, the system checks it for correctness. If the answer is incorrect, the Silent Teacher points out the correct answer. Once we are ready for the next challenge, we can continue with a new, similar exercise on the same topic.
And as we get more exercises right, the system shows more advanced challenges. The user gradually learns about programming language elements and functions from the core libraries through many small repetitions.

Exercise in Elm Silent Teacher

Elm Silent Teacher - evolved

Compared to the earlier implementation, I adopted a different approach for encoding exercises, simplifying the authoring process. Course authors no longer need to provide a function that computes the correct answer. An interpreter now takes care of this part automatically, running the evaluation on the user's device in the web browser.

Since the interpreter is readily available, users can also experiment with additional expressions. After submitting their answer, they can access a REPL-like sandbox initialized with the exercise's expression. In this exploration mode, users can modify the expression and observe how the evaluation changes accordingly.

If you took the trip, let me know how it went. I'd love to hear your thoughts.

Top comments (0)