Crash Course in Coding

I am coaching two groups of girls in the Tech Girls are Superheroes competition. The girl members are in Year 8 & 9 and they have had no real computer programming learning before this competition. Out of the 2 groups, 3 members have been identified as our ‘coders’ and I have had the pleasure (& pain!) of teaching them how to computer program. It’s been painful because we have struggled with finding time to meet and the competition requires so many other things, such as research, competitive analysis, writing business plans, etc., that there just hasn’t been enough time to run through a thoughtful step-by-step teaching sequence. So our approach has been 1) what do you want your app to do?, 2) what can you find on Youtube? lol, 3) play around with it yourself and 4) OK, let’s make time for Mrs Schneider to show you how!  It’s been less than ideal, but it’s been fun anyway.  Our coders have hacked their way through connecting to web databases, integrating Google maps, and learning the basics of arrays & variables.

I wanted to share a beautiful learning/coding moment I had with my Year 8 coder on Thursday morning. She has never computer programmed anything before but she’s super keen!  This bit of discussion shows you how, due to inexperience, she knows the end result but doesn’t understand how you need to code the steps to get there.

Year 8 Hacker-wannabe: “Mrs Schneider, I want to add all the time that a user plays the game and put that time in the database. Retrieve it and update it every time the user plays the game. Then I want to add Levels depending on how long they’ve played”

Me: “OK, so first we need to create a variable to hold the time value and we need to put it in a label so that we can first test that we have the right value” I proceed to show her how to create a variable and link the value to a label text.

Year 8 Hacker-wannabe: “Yes, but we need a database. We need to add it to a database.”

Me: “Yes, but we have to check that we are getting the right value first.”

Year 8 Hacker-wannabe: “No, we need to stick it in the database.”

Me: omg! keep calm! “Yep, we will. Trust me! Before you throw stuff in a database, you want to first make sure that we can get the right data first.”

After 10 minutes of dragging-dropping code in MIT App Inventor, testing on the mobile phone, and loads of discussion & teaching, we made it work. I saw the best “aha!” moment ever from this lovely Year 8 girl, she totally got it and I know she felt awesome. We high-fived and made lots of celebratory noise, much to the annoyance of the other members in the group who were madly researching for the business plan. Here is some of the code below to show you parts of the complexity that was taught in my 10-20 minute crash course on coding:

code_variables

I had to explain the difference between a global and a local variable. The global variable was needed so that we could access the Time Played value when the user clicks on the Back button (when they leave this screen). When the game starts (.initialize) the code gets the stored value of Time Played (accumulated from previous playing) and then we add that value to the global variable. We also add that value to a label on the screen.

code_incrementNum

The clock timer starts when the game starts (or when the screen is opened). The second piece of code in this method shows the very awkward way you have to code increment, unlike some other languages: label++ This is an example where drag & drop is actually more complicated than it needs to be.

code_dbStore

When the user clicks the Back button (when they leave the game), the app will store the new value of the accumulated time played. Notice here that we’ve added the global time (which was the previously stored value) to the time played in this session (which is in a label; a variable would be better, but this was easier to code!). The label is also updated, mainly for testing purposes.

3 comments on “Crash Course in Coding

  1. Marg says:

    OK
    Glad to hear the school kid understood; cos I don’t!! But then I’m a nurse!!
    M

    Like

  2. […] I am coaching two groups of girls in the Tech Girls are Superheroes competition. The girl members are in Year 8 & 9 and they have had no real computer programming learning before this competition.  […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s