What Does an If/Else Statement Does?
The concept of an if/else statement is pretty simple. The code can be written as follows:
if (a specific condition is TRUE) {
then this happens
}
else {
if the above statement is FALSE than this happens
}
There are more complicated versions of this code where more condition are necessary for a specific event to occur, but this is on the most basic level how the code works. It is really a true or false question. If you understand this, then you will be able to understand the more complicated versions of this code as well.
Metaphor Idea #1
My first idea for how best to explain this concept to someone one who does not know code was through directions. I was thinking about GPS navigation devices, and how you ask them to create a route for you, but they know that IF there is a road block or something happens then they need to find you a detour, ELSE they keep on the same route you were originally going to take. I figured the best way to show this would be to make an interactive booklet. Based on GPS directions, and using symbols like you see on road signs and in directions from Google Maps and such (of course I would create my own set based on the standard images), I plan on making pages in a booklet with tags you can pull out so that IF you pull out the tag meaning that if there is a road block or something of that sort, the page directions you have on the page will change, ELSE you will be able to continue along your original route.
This idea would not only show, through the interactivity of the book, how the if/else statement works, but it would also be a fun book to pick up and play with.
Metaphor Idea #2
My second idea is based on the old paper fortune teller game I used to play when I was little.
The way this game is usually played is that you have someone choose a color from one of the 4 original flaps, and based on that color you open and close the fortune teller the same number of times as the letters in the word. So for example, if someone were to choose green, you would open and close the fortune teller 5 times. Then, inside there are numbers. That same person chooses a number from the inside of the fortune teller and you again open and close the fortune teller the same number of times as the chosen number. This happens one more time, but this time when that person chooses a number you flip open the flap of that number to find a message or fortune waiting for them inside.
I want to use this game to show how an if/else statement works. The pseudo code would work as such:
If (a color is chosen) {
open and close the fortune teller the number of letters as in the color
else if (a number is chosen) {
open and close the fortune teller than many times
else if (a number is chosen again) {
open the flap of the number and read the message
}
}
}
Else {
if a color is not chosen nothing happens
}
I'm not yet positive what I would use in place of colors and numbers to fill out the metaphor and have people really understand how the if/else statements works, but I think this would be an intriguing way of explaining the concept. People would definitely want to pick up the fortune teller and play with it. This would help show the interactivity of code, and how you need someone to interact with the program if you want an if/else statement to work properly.
Metaphor Idea #3
My final, and now favorite idea, is an interactive poster. I want to use the same pull tag as in my original booklet idea, but on a larger scale. The biggest difference between this idea and my other ideas is that the pull tag, in this case, would represent the true or false aspect of an if/else statement. In code, when an if/else statement is triggered, the result happens simultaneously. My poster would, therefore, exemplify this idea by changing at the same time as the user pulls the tag.
I have two ideas for this poster:
First, the poster would be extremely minimalistic. The main focus would be the pull tag, which when pushed in would read "PULL" and when pulled out would read "PUSH." The pseudo code for this would be:
If (the tag is out == true) {
the tag will read PUSH
}
Else {
the tag will read PULL
}
This idea may be too simple, and not very interesting, so my next idea adds a little bit more to the same concept. In this case, the image on the poster would be a tree, and the pull tag would be the tree's trunk. As you pull out the tree's trunk, the colors of the leaves on the tree will change from green to gold (or some other colors I will decide later) representing the change from Summer to Fall. The pseudo code would read:
If (Fall == True) {
the color will change from green to gold
}
Else {
the color will be green
}
This poster, would not only exemplify the if/else statement in the functionality and interactivity of the poster, but also in the metaphor it portrays (the changing of the seasons).
Plan for the Next 2.5 Weeks
By the end of Tuesday's class, I plan on choosing which metaphor I want to create. By Friday, I want to make a prototype of my final idea so I can begin to work on it to scale the next week. I want to basically have the project done by next Friday so that I can fix any bugs or printing problems over the weekend so that I have my final ready for the hand in on that Tuesday.