Sunday, December 9, 2018

Subgoal Labeling (Part 3) and CS Ed Week

It was another busy week at The Pinnacle as we wind down the first semester.  Congrats to our Timberwolves cheerleaders who won the Colorado State 3A Cheer Championship!  The TSA (Technology Student Association) students learned about careers in Security from Aaron Goldstein of Tanium.  Then they competed in the second round of Cyber Patriots.

Subgoal Labeling

First, thanks much to the valuable input from Lauren Margulieux and Mark Guzdial, I am learning more and more about subgoal labeling as a means of teaching CS concepts.  Briefly, the things that I have learned:
  • subgoals are different than the high level goals of a lesson
  • subgoals should be very granular - associated with one or only a few lines of code
  • subgoals should be short and memorable
  • subgoals should be repeated
I am tackling the first two points in my next lesson on using the Scanner class to read files.

High level labels and subgoal labels

The first thing I have learned is that what I was thinking of as subgoal labels are more appropriately the high level goals or CS Concepts.  Subgoal labels should be thought of as the individual steps or lines of code to implement a CS Concept.  Subgoal labels can often be attached to a single line of code.  

This week my students were introduced to using the Scanner class to read files.  I continue to teach a lesson using a starter file with comments and as we discuss concepts we write the code together.  Here are the high level goals for the lesson:
  * Using the Scanner class to read and parse Files
  * In the past we used the Scanner class to read and parse input from the keyboard and Strings.
  * Now we will use the Scanner class to read and parse input from a File.
  * 1. Review reading input from a String with a Scanner
  * 2. Read a File with a header
  * 3. Read a File without a header
  * 4. Read a File with lines of text to be parsed

Subgoal labels -- the finer points

The lesson had three main goals.  Introducing students to
1) Read a file with a header such as the number of lines of data contained in the file. 
2) Read a file without a header record, meaning the code should check if there is more data, before reading a record. 
3) Finally reading a file that has multiple lines and each of the lines should be processed using a Scanner with a String as noted in the previous lesson.

Each of the goals contains multiple subgoals and these subgoals are typically one or only a few lines of code.   As an example the goal of reading a file with a header record begins with a subgoal of creating a File object to represent the name and location of the file.  Because my students split between using Notepad++ and compiling their code at the command prompt and using the Eclipse IDE some of the notes reference both of these.

// 2. Read a File with a header record

// 2a. Create a File object represent the name and location of the file
//     You do not need to specify the directory if the file is in the
//     same location as the Java class if you are using Notepad++
//     or current working directory if you are using Eclipse.
File fileName = new File("for.txt");

// 2b. Create a Scanner with the File object
Scanner file = new Scanner(fileName);

// 2c. Read the header record
int numLines = file.nextInt();

// 2d. Create a for loop from 1 up to the record header
int total = 0;
for (int i = 1; i <= numLines; i++)
// 2e. Read the other records in the for loop using one of the next___() methods
number = file.nextInt();

// 2f. Perform any processing needed
total = total + number;

Things that still need to be improved

Some other things that were pointed out that I still need to work on.  First, is that the subgoals should be short and memorable.  I think this needs to be improved.  By nature I use many words to describe something and realize that to be memorable the subgoal should be brief.

Next I need to provide an additional example or two that uses the same subgoal labels so students can see multiple examples.  This sounds like a summer project to me!

For the complete set of code for this lesson click here.

CS Ed Week

CS Education Week came too quickly, and I didn't have time to get much done.  For me the first week of December is inconvenient.  Most of my classes are finishing off one last unit before preparing for semester exams, and taking some time out to do an extra task doesn't fit in well.  I would much prefer doing something in February for our eighth grade students as they are about to start signing up for their first high school classes.  And I think I may ask our Middle School if we can come back for day at that time.

Using Unity to add tiles to construct
a game.

Let's Play!

As a result, the Pinnacle had a small showing for CS Ed Week.  The students in Game Design were finishing off their 2D Platformer games using the Unity 2D Game Kit, so I had the students show off the Unity Game Engine to a group of our sixth grade students.  Then the students got to play those games.  It was a fairly small effort that didn't impact many students, but we did leave the sixth grade class with some ooh's and ahh's and a couple of students asked what class they should sign up for in high school if they wanted to design games, so I called it a success.

No comments:

Post a Comment