Exploring Programming with Hackety Hack
by Andy Harris
In this lesson, I discuss a wonderful tool for experimenting with programming called Hackety Hack, and provide some lesson plans that will reinforce use of this tool. Note that the different lessons will be suitable for different ages and experience levels, and some will require help from a parent. Programming—even at this simple level—can be complicated, so some students will be able to do an entire lesson in one day, and some will need more time to think about things.
Note that these lessons are real computer programming, and they can be difficult. Students will likely need to look online or in books for more help. I really like Chris Pine’s book Learn to Program (Second Edition), which is available free online at http://pine.fm/LearnToProgram/.
These lessons are best for students in middle school and high school. Younger students who are motivated may enjoy them as well. And all students may need parental help here or there.
The Windows version of Hackety Hack is very unstable in some versions of Windows. It may crash frequently. You may need to restart, but normally your files are saved. This is inconvenient, but not deadly.
Week One: Learn Hackety Hack
The first step is to download and install the Hackety Hack program. This software is available for all major operating systems from http://hackety.com. Once you have downloaded the software, run it, find the lessons, and run the first lesson, “A Tour of Hackety Hack.”
Write a program that tells a knock-knock joke. It might go something like this:
Computer: What is your name? Human: Andy C: Hi Andy! Here is a joke: C: Knock knock H: Who’s there? C: Luke H: Luke who? C: Luke through the keyhole and you’ll find out!
You’ll learn everything you need from the “Tour of Hackety Hack” tutorial.
You’ll only need two commands. You can use more, but try to do it the simplest way first.
You will need at least one variable (like “name” in the tutorial).
Save your program, test it, and show it to your friends and family. They’ll be impressed!
Especially if your joke is funnier than mine.
Week Two: Teenage Mutant Coding Turtles
After you’ve gotten some basic practice with Hackety Hack, you’re ready for a more interesting problem. Now you’re going to draw!
Make sure you’ve done the first exercise, then go back to Hackety Hack. Run the second lesson: Basic Programming. This program introduces an idea called Turtle Graphics. Run through all the examples—you may need an adult helper for some of this—and try this on your own. Once you understand how to make the turtle draw, get ready for a challenge.
Your job is to build a flower image. Mine looks like Figure 1.
You can do this program using only the skills taught in lessons 1 and 2. (However, if you want to skip ahead to loops, you can do it more efficiently.) Here are a few hints:
- My flower is really made of ten squares
- Learn to set the foreground and background colors
- Make a simple square first
- Figure out how to make another shape from many squares
Have fun. See you next week!
Week Three: Make a Game!
Read Lesson 3: Basic Ruby. This lesson gives you a basic overview of programming in general and Ruby in specific. The tutorial takes you through a very simple guessing game. Your job is to enhance the guessing game in the tutorial to make it complete. Here’s a sample transcript of the game:
Computer: Your guess? Human: 50 C: Too high C: Your guess? H: 25 C: Too low C: Your guess? H: 30 C: Too high C: Your guess? H: 27 C: You got it! C: It took 4 turns
Note that the tutorial doesn’t tell you everything you’ll need to make this game. You’ll need to use an online reference like http://www.tutorialspoint.com/ruby/ or http://www.humblelittlerubybook.com/book/html/index.html to learn the following new concepts:
- while – This structure allows you to repeat as long as a comparison is true
- elif – This variation of an else statement allows you to check another comparison
- .to_i – Takes any text (like the input of an ask statement) and converts it to a number
- .to_s – Takes any number and converts it to text (called strings in programming) so you can print it out
- rand() – Creates a random integer from 0 to
This can be a very tricky project, but keep working on it and you can get it!
Week Four: What You Gonna Do in Those Shoes?
Now you’re ready to build a graphic user interface. Hackety Hack comes with a nice user interface tool called Shoes (like Ruby Slippers, I guess). You can use this toolkit to build an interesting user interface. As usual, follow the online tutorial to get started, then create a little greeting program. Your greeter should do the following:
- Display a picture. Find a picture online or on your local system and display it.
- Ask the user to enter his or her name. This will probably be a para element.
- Have a field for the user to enter the name. You’ll probably want an edit line for this.
- Add a button.
- When the user clicks the button, use an alert to greet the user. Be sure to incorporate the user’s name in your greeting.
- Dress up your program with stacks and flows, and maybe play with fonts.
Have fun! Ruby is one of many interesting languages that are useful for students to learn. There is much more to learn, but this is a great place to start.
Andy Harris loves learning and teaching. He has taught all levels, from kindergarten to grad school, and every subject from special education to advanced computer programming.
Andy currently teaches freshman computer science, game programming, and web programming at Indiana University/Purdue University–Indianapolis (IUPUI.) He also sometimes teaches a computing class at his family’s homeschool coop.
Andy has written a number of books on computer programming topics including HTML / XHTML / CSS All in One for Dummies and Game Programming – the L Line. He is also the author of The Tech Homeschooler column in The Old Schoolhouse® Magazine. In this role, he illustrates ways technology and computing can support the homeschool environment.