Teaching Coding, Part 7

Yesterday, we wrapped up our study of Python by working through a rather complicated program of Hangman. You can see the source code here. It has several defined functions, lots of else-if statements, for loops, and lists. I think the girls were a little overwhelmed; by the time we got to the end of the program, their eyes were glazed over!

So, for a fun change of pace, we began working with MIT’s AppInventor. This is a website that allows the user to create Android apps. It’s very similar to Scratch, which we worked with in the beginning of this coding minicourse. You can login with a Google account, and it automatically saves your projects as you build them. There are some excellent tutorial screencasts that walk the beginner through the basics. After about 45 minutes, you will have created your own working  smartphone app! The first one we built had a picture of a cat meow when you tap the phone’s screen.

Here’s a screenshot of the designer page, where the components of the app are put together:

designer

The left pane contains the various components and layout options. The middle pane simulates the phone’s screen. The third and fourth panes let you modify each component’s properties.

The Blocks page is where you actually program the components of the app. As you can see below, it works just like Scratch, with drag and drop blocks of code:

blocks

Today, we will build a painting app that lets the user take a picture and paint on top of it.

Teaching Coding, Part 3

Our second day of class was a lot of fun; the students shared the games that they coded. You can click on each screenshot to go to the actual game. Some of them are quite challenging!

Emily’s Game

Emily's Game

Lucy’s Game:

Lucy's Game

Caroline’s Game:

Caroline's Game

Allison’s game:

Allison's Game

Delaney’s game:

Delaney's Game

The day’s new material involved using the pen feature in Scratch to draw figures. We coded a program that drew a triangle everywhere you clicked your mouse. We wrote a function, Draw a Triangle, that the program called up whenever the user clicked the mouse. We also learned how to create new variables. Click the screenshot below to go to the program. You can click the “See Inside” button to look at the code.

Triangle

Teaching Coding, Part 2

As I mentioned in a previous post, I’m teaching a three-week minicourse on computer coding.

School was closed yesterday (due to the Arctic Polar Vortex delivering freezing rain, snow, and pushing temperatures into the single digits), so today was our first day of class. I have five students, none of whom have any coding experience.

We kicked things off by creating accounts at Scratch, and exploring the various features of the programming environment. We then coded our first program: making a “sprite” (a programming object) say, “Hello World!”:

scratch1

I could tell my students were getting excited about this, because they immediately began customizing this simple program. Realizing you have the power to make your computer do exactly what you want is very addictive!

Next, we designed and coded our own games, which involved maneuvering a sprite past a moving obstacle to reach a goal. Here is the one I created to demonstrate to the class the basic features of the game. Here’s a screenshot:

scratch

Every girl came up with her own unique and entertaining game, with some nice features. Tomorrow we’ll share them with each other.

Teaching Coding, Part 1

Scratch

My school has a three-week period between semesters called Winterim, where we offer an alternative curriculum. This year, I am taking the plunge and teaching an intro to computer coding. One of the biggest challenges of teaching at an all-girls school is sparking interest in computer science among my students. Hopefully, this minicourse will get a few girls inspired to pursue the subject further, and we can build on that. So, I’ll be writing a series of posts in the next couple of weeks to share with you what works and what doesn’t.

The basic course outline is this:

  1. Intro to coding through Scratch. (The screenshot above is from the Scratch programming environment.)
  2. Intro to Python by designing some simple games. For this part, I’m using Al Sweigart’s Invent Your Own Computer Games with Python. It’s available for free online here.
  3. Design your own Android apps. I’m using MIT’s App Inventor website in conjunction with the book App Inventor to do this. You need a Google account to log into the website.
  4. Time permitting, we’ll learn the basics of TinkerCAD, and print out some 3D projects.

I’ve spent the past couple of days exploring Scratch, and that will be the subject of my next post.