Gamifying the learning experience by using a quirky metaphor.
As a passionate developer, I have tried to show others the joys of solving problems by telling a computer what to do. To me, programming has always been a puzzle-solving experience. And from day one, this has captivated me. So how come others, even though they enjoy solving puzzles, have not caught the code-bug?
From time to time, one of my friends has endured a programming lesson by me, only to get demotivated quite quickly.
At first, I thought it was because my language of choice (Java) is quite verbose, and has somewhat confusing syntactical constructs. For example: Try explaining that a simple "hello world" program needs a main class and static method to just print a message to the screen...
But even when I switched to less heavy languages, such as Kotlin or Python, the results were similar. A couple of failed tutoring attempts later, I got to thinking. The main difficulty for my students always seemed to be to transcribe their thoughts and solution attempts into executable code. More difficulties arose when the code ended up doing something they did not expect.
Reading the book "Apprentenceship Patterns" resulted in somewhat of an Eureka moment for me. Why not use a visual metaphor so coders-in-training can solve the problem first, before jumping into the nitty-gritty of writing working code. Following the "Think before you act" proverb, so to say. This idea is not new at all, though. In olden times, people would write out their programs using flow representations (such as the infamous Nassi-Schneiderman diagrams). The difference between those diagrams and the approach I am suggesting, is the additional level of freedom, a less formalized notation, and a more worldly mental model.
In order to illustrate the approach, let’s start off by introducing a simple assignment and a puzzle. I will give you an assignment to solve, and you try and find a way of getting the right result.I give you a word, and want to know how many times a certain letter appears in it.
“That’s easy, you just count” is probably what you are thinking right now. Fair enough, but what if I gave you an entire dictionary of words? It would probably take you multiple days to complete the task. Tasks like these are where we would like some trained monkeys to do the job for us. Unfortunately, trained monkeys are in high demand right now (mostly for filling coding vacancies for extreme cost-cutting companies). So we will have to do a bit of mental traveling to a simpler time: the middle ages.
Introducing the workshop
Imagine you are the wealthy owner of a medieval workshop that provides services to the king. The people working in your shop are lowly peasants, and are very limited in what they can do. The king has given you an assignment to complete. If successful, you will become even richer. If you fail, you will probably be beheaded.
So, how does our workshop operate? Put simply, we have workers at our disposal that are able to perform a few simple tasks. These workers can not complete the complex task that the king has given you by themselves, so they need to work together. This is where you, the workshop designer, come into play. You have been asked to design a work-flow for your workers, so that the desired result is achieved. You will do this by drawing a layout for your workshop. Some general rules apply to building a workshop. On other occasions, there are specific rules for an assignment that overrule these general rules.
The people in your workforce
- Are not allowed to speak to each other as you do not trust them not to entice rebellion. They are only allowed to communicate by passing each other notes or boxes containing items.
- Are unlettered, they can not understand the meaning of written words.
- Are able to count, and write down numbers.
- Are able to see if things that are written on a note are identical, by comparing shapes. They are not able to recognize similar shapes when these shapes are surrounded by other shapes.
- Are unable to remember things, so they have to write down all information that is needed.
- Your workers sit in your workshop, and each can perform a very specific and simple task. Then they pass the thing they are working on to the next person.
- To keep the floor organized, you can group people together in a room.
- You can pass boxes or notes from the main room into a specific team room through the ‘IN’ door, and the other way around through the ‘OUT’ door
- You can have as many items going in to a room through the IN-door as you want
- Only one item is allowed to leave a room through the OUT-door. You are allowed to put multiple things together in a big box (or boxes in boxes)
- Each room is equipped with a blackboard that can be used to share information within the room (but workers can only see the blackboard in the same room).
- Each room has an educated ‘master of the blackboard’ that is able to write on the blackboard, but can not perform any other tasks.
- Workers only have access to the blackboard in their own room
- Every time a box leaves the room, it is cleaned:
- the blackboard is wiped
- all lingering notes and boxes are thrown out.
- At the very end of your workshop, there is a ‘scribe’. This is a worker that is able to transcribe shapes (or letters) from a note onto a preformatted form.
- As you may have guessed, this is ideal for sending messages to the king
Note that you may put everyone onto the main room’s work floor if you want, and you may put as much shapes on the main blackboard as you want. The blackboard is intended as a way to not have to draw too much note passing within the same room. However, your workshop will look more pleasing if it is nicely organized into rooms, and if the blackboards are not overly full.
See if you can use these rules to solve the following assignment:
The king would like to know how many times his favorite letter appears in a selection of words from his personal library. He has far more important things to do than to count letters, obviously he has a kingdom to run. It is up to you to design a system of making this happen. The king’s advisor has entrusted you with the knowledge that the king tends to change his mind about what his favorite letter is a few times every month. She advises you to take this into account. His majesties messengers will bring you a note with the word the king would like investigated, as well as a note with his current favorite letter. Your workshop will do the counting.
Since this is supposed to be an example on getting acquainted with writing software, you might expect us to dive into some obscure editor and start churning out 0’s and 1’s. I hate to disappoint you already, but we will solve our little puzzle with nothing more than some paper, a pen, and our brains. So, let’s get to it. In order to draw your workshop layout, it is imperative that you have good understanding of what comes in to your workshop, and what is supposed to go out. Let’s start with that:
Now that we know this, we will start on designing our workshop following the rules above. If this is a little to abstract of an assignment for you, here is a list of the actions your workers may perform:
- Put notes in a box
- Take notes out of a box
- Cut a note into pieces (splitting)
- Compare shapes to each other
- replace letters with their uppercase version (using a book of matching shapes)
- replace letters with their lowercase version (using a book of matching shapes)
- Count items/shapes
- Count how many times they do something (by drawing lines on paper**
Apart from these actions, you might also need to indicate how many times something should be done, or when to do them. This can be done in a lot of ways, a few examples are:
- As long as there are items in the box
- do this N times
- if these shapes are the same
- if these shapes are not the same
And now, get to it! No seriously, I’ll wait for a bit. Below this line is the next section that contains one possible solution to this problem. There are however multiple good solutions. If you want to see whether or not you solved the problem, try out your flow (on paper) with a few choice words and favorite letters. Be creative!