The Bootstrap Blog

Software Engineers Write Examples, and so should Students!

Bootstrap teachers know the emphasis we place on the Design Recipe, and in particular, writing examples (or "test cases"). Most Computer Science courses in K-12 don't teach testing at all, and even in college, testing is considered an upper-level topic. So why are we introducing it to kids as young as 11? It turns out teachers in every other subject have known for years what CS teachers are just starting to figure out: there is enormous value in having students show their work, and go from the concrete to the abstract! This practice has several benefits, which we'll talk about in this post.

Classroom Scale

In a classroom of 30+ students, it's not always possible (or a good use of time!) for a teacher to give concrete feedback to every student. Educators understand the challenge of providing individualized attention, especially for the struggling student. Having students type their examples into their program allows each student to check their own work, and know immediately if they are on the right track. The push of a button tells students whether their tests pass or fail, and if they'll need to make changes to their thinking process to complete the task at hand. The integrated testing provided in Bootstrap allows students to review their work in real-time, without waiting for teacher intervention. This lets teachers spend their time focusing on students who need the most help, or answering higher-level questions.

Instant Feedback

A high-achieving student might be impatient for teacher feedback . A struggling student might not want to wait at all, or be anxious about what kind of feedback their teacher gives them. This anxiety is exacerbated if that student is already worried about his or her math or programming abilities, or dealing with stereotype threat. The instantaneous feedback offered by Bootstrap's integrated testing described above helps address both issues. The computer doesn't judge and doesn't wait, making it easier to incorporate instant feedback from test cases into their learning.

Students discover the need for structured data by programming a 2-dimensional delivery path

Deeper Learning

"A rocket blasts off, traveling at 7m/s. Write a function that describes its height as a function of time"

Students examine different versions of code to produce the same emoji, identifying the benefits of reusable code
Even before touching a keyboard, Bootstrap students already incorporate core mathematical principles of abstraction into their pencil-and-paper Design Recipe problems. In a regular math class, a teacher will often start the problem above by asking students to write examples showing how the function works when given specific inputs. How do we know how high the rocket will be after 2 seconds? 99 seconds? Writing these tests help make students' thinking explicit for themselves, and their instructor.

These examples are a great way to check for understanding, and scaffold the formal function definition . This process of taking a complex word problem, working through specific, concrete examples, and turning them into an abstract tool for use with any input, is something that great teachers already do. Some teachers use input/output tables to show concrete examples, and some teachers ask students to "find the rule" for a function, but this concrete-to-abstract problem solving process is already a staple of math classes. With Bootstrap, the same process can be directly applied to computer programming as well.

So Why Doesn't Everyone Test?

Students examine different versions of code to produce the same emoji, identifying the benefits of reusable code
If testing allows for better scale, less anxiety and deeper learning, why doesn't everyone do this? It turns out that testing is really hard in languages like Scratch, Snap!, Python and Javascript! Because Bootstrap uses functional programming languages like Racket and Pyret, every function passes the vertical line test and returns the same value for the same input every time. In contrast, functions in other languages aren't mathematical at all, making them much more difficult to test. For example, take the following code:

Every time f is called on any input, the value of foo will increase by 1. Because the current value of foo depends on how many times f has been called, both of these tests will pass. But if we swap the order of the tests, they both fail. Even worse, running the same test ( f(1) == 1 ) twice will cause one to pass and one to fail! That means that students not only have to think about the content of the test they write, but also when the test is used within their code, and all the tests that come before it.

In a functional language, however, testing becomes much easier. g(10) will always return 20, regardless of other tests, functions, etc.This ability to reason about the code and functions they write, and predict what will happen when given certain inputs, is an invaluable part of testing in software development and showing one's work. Don't believe us? Read any number of programmer blogs! Visit a Google engineering office and look at the one place where they have their employees' undivided attention: the toilet. (Seriously: it's a series called "Testing on the Toilet"!)

In Bootstrap, students develop their programs by generalizing from examples, which are written as tests. The complexity of testing in a non-functional language means that these techniques typically aren't taught to Computer Science students until upper-level college classes. In Bootstrap, these tests are not only a way of checking the program but also a way of developing it. Thus, by using languages that make testing easy, Bootstrap can introduce testing early in students' Computer Science experience, while reinforcing important concepts that come up in other subjects like algebra and physics.

Since the dawn of time, math teachers have told their student to "show your work"; Bootstrap takes this one step further. Not only do our modules encourage students to make their thinking explicit, but everything from our editing environments to the programming languages themselves set students up for success and confidence in their mathematical and programming journeys.

Posted February XXX, 2018