Test Driven Learning
I recently got into learning how Language Server Protocols work and exploring an idea I have of an interactive course that walks you through the code and challenges via a LSP.
While exploring LSPs I failed miserably at quickly understanding it, and later in that day, I thought to myself that I lacked a faster iterate cycle during that process.
Faster Iterate Cycle
This might not be new to you, but when programming, it is ideal to always optimize for faster iterations. You want to see the results of your change as soon as possible, it makes it easier to understand the code behavior.
The result of this is we see things like a REPL and “Hot reload” advertised in languages and framework as features. It is because they are very helpful.
Learn Through Testing
One other way to rapidly check if the results of your changes match the outcome is through unit testing. This makes me think that unit testing makes for the perfect learning tool, it is active, experimental, and you are constantly verifying your hypothesis - all of this is exactly how Richard Feynman thinks you should be learning.
Not A New Idea
This is not a new idea either, Googling “Test Driven Learning” you get a few results like:
- Test-Driven Learning: A Better Way to Learn Any Programming Language - Simple Programmer
- TDL, a (programming language) learning framework | thePHP Website
- Test-driven learning: intrinsic integration of testing into the CS/SE curriculum: ACM SIGCSE Bulletin: Vol 38, No 1
Fail fast is famously coined in the DevOps world. In Peter’s blog he mentions applying this to learning:
We can apply the same concept to learning. Fail as often as you can, and learn as much as you can from those failures.
In the white paper about Test Driven Learning (TDL) it states:
“Initial evidence indicates that TDL can improve student comprehension of new concepts while improving their testing skills with no additional instruction time. In addition, by learning to construct programs in a test-driven manner, students are expected to be more likely to develop their own code with a test-driven approach, likely resulting in improved software designs and quality”
dl.acm.org (Accessed Thursday, May 27, 2021)
You will not only learn the language but also how to test it and write code that is easily tested, it is a win-win.
Next Steps
If you are an absolute beginner setting up your own environment can be daunting, sites like FreeCodeCamp, Khan Academy, CodeCademy do follow a similar make the test pass structure.
If you are not an absolute beginner start learning by figuring out how to set up a testing environment. Then little by little start validating the language features.
The interesting assumption here is by using a local testing environment you can explore any advanced feature in that language.
You can take this further if you are testing a framework by trying its end-to-end/integration capabilities.
More Resources
I might do another post in the future of what this could look like in practice. There a few resources I found online like:
- Ruby Koans is a book that applies TDL to learning Ruby.
- Learn Go Through Unit Tests is a repo that applies this exact idea.
- TDL, a (programming language) learning framework | thePHP Website has some practical examples of how he applied TDL to learning Rust.