Sunday, December 2, 2018

Subgoal Labeling - Revisited

Assorted Clothing Tags
Labeling Christmas gifts and steps for using the Scanner class.

The first week back after fall break is always a scary thing.  How many students have used the one week off to purge their mind of almost everything they have learned?  I decided to start the first day back with a review day for most of my classes and was very happy I did.  That refresher is helpful for everyone!

As I start to buy Christmas presents and attach the name cards, I am reminded of how important labels are to sort out Christmas gifts and also to label steps in learning a new CS concept.  So I am returning to what I am doing with subgoal labeling in my AP CSA class.  At its most basic the way I implement subgoal labeling is by creating a numerical list of the steps to teach or implement a new concept in Java.  It seems very simple, but it makes for a good way to go through a lesson.

Subgoal Labeling


I blogged about subgoal labeling and worked examples a few months ago.  The concept seemed very basic but it was not something I was doing in my course.  I dabbled with it a couple of times, but now have started using it consistently for my notes.

The way I have students "take notes" for my AP CSA class is by coding together.  I provide students with a skeleton file with comments that describe what we will be doing.  To implement subgoal labeling, the notes are now numbered.  To demonstrate how I subgoal label, let me give you the three steps that I follow for my notes with subgoal labeling.

1. The notes begin with two statements:  "In the past we...." and "Now we will...".  These statements tie the concept that we are learning to things that the students have already learned.

2. Then the notes have the list of steps that we will follow for the day.  The notes begin with a step or two that are review and then move into the new concept.  As an example here is the block comment at the beginning of the notes from last week's lesson on using the Scanner class with Strings.

/**
  * Using the Scanner class to read and parse Strings
  *
  * In the past we used the Scanner class to read and parse input from the keyboard.
  * Now we will use the Scanner class to read and parse input from a String.
  *
  * 1. Review reading input from the keyboard with a Scanner
  * 2. Review reading a line of input from the keyboard with a Scanner
  * 3. Create a Scanner instance with a String
  * 4. Parse integers using the Scanner class
  * 5. Use a delimiter other than space to separate tokens
  *
 **/

3. What follows in the notes is an expanded version of each of the steps along with code.  I typically provide all of the code for the review steps and leave blanks for the steps that are new for the lesson.  In the example above steps 1 and 2 were review and the code was provided.  Steps 3-5 were new material and the comments were in place but the code was not and we wrote the code together.

4. As a final step I typically go back to the beginning and review the steps.  The comments range from "Yes, we're done!" to "Oh, that's it?".  This method seems to me to be one of the basics of presentation -- tell them what you are going to say; say it; tell them what you said.

I will be taking a survey at the end of the semester, but so far, I feel that this is a good way to teach concepts and it provides students with a set of notes to go back to.  They can quickly review the top set of steps and look at the details if needed.

I would welcome input on whether or not I am getting this correct as far as the intentions for subgoal labeling and worked examples.

Completed Example


At the end of the lecture, here is the code that students will have in place.  If there is a day when I can't be there I can provide the worked example of notes.

Here is the completed set of notes for using the Scanner class with Strings:

import java.util.Scanner;

/**
  * Using the Scanner class to read and parse Strings
  *
  * In the past we used the Scanner class to read and parse input from the keyboard.
  * Now we will use the Scanner class to read and parse input from a String.
  *
  * 1. Review reading input from the keyboard with a Scanner
  * 2. Review reading a line of input from the keyboard with a Scanner
  * 3. Create a Scanner instance with a String
  * 4. Parse strings using the Scanner class
  * 5. Use a delimiter other than space to separate tokens
  *
 **/
public class Unit12Notes
{
public static void main(String args[])
{
// 1. Create an instance of a Scanner and read input from the keyboard
Scanner keyboard = new Scanner(System.in);
System.out.print("Enter an integer: ");
int number = keyboard.nextInt();
System.out.print("Enter a word: ");
String word = keyboard.next();
System.out.println("The number is " + number + " and the word is " + word);

// 2. You can also read a line of input from the keyboard up to and including the newline
keyboard = new Scanner(System.in);
System.out.print("Enter a line of input: ");
String line = keyboard.nextLine();
System.out.println(line);
System.out.println("word");

// 3. A Scanner can also be created with a String.
//    Instead of reading input from the keyboard, the program 
//    reads the input from the String
Scanner chop = new Scanner("12 5678");
number = chop.nextInt();
System.out.println(number);
number = chop.nextInt();
System.out.println(number);

// But Java throws an exceptions if there is no input
// uncomment the following line of code and run the program to see the exception
//
// number = chop.nextInt();

// 4. With the keyboard the input was limitless, 
//    but udinh a String means there is a limit to the input.
//    This means we need to check if there is more input using the hasNext() methods
//
//    This is a good way to "chop" up or parse input,
//    we can loop by first checking if there is more input
//    as long as there is more input, keep reading in the next integer.
chop = new Scanner("12 13 14");
while (chop.hasNextInt())
{
number = chop.nextInt();
System.out.println(number);
}

// 5. A space is what separates the numbers above
//    We can use a separator or delimiter other than space using the method useDelimiter()
//
//    We can use this to read in integers, doubles, and even Strings within a String
chop = new Scanner("Washington,Adams,Jefferson,Madison,Monroe");
chop.useDelimiter(",");
while (chop.hasNext())
{
word = chop.next();
System.out.println(word);
}
}
}

7 comments:

  1. Would love to constantly get updated outstanding web blog!

    ReplyDelete
  2. Woh I your content, saved to fav!

    ReplyDelete
  3. Hey there would you mind stating which blog platform you're using?

    I'm planning to start my own blog in the near future but I'm having
    a tough time deciding between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your layout seems different then most blogs and
    I'm looking for something unique. P.S My apologies for being off-topic but
    I had to ask!

    ReplyDelete
    Replies
    1. I use blogger.com, but am using this as my school is using Google, so I selected the blog tool that comes with Google. I didn't do any research before selecting it, but am happy with it so far. Not until this entry did I have an "I Wish" and I wish there was a way to attach a file to the blog so I didn't have to cut and paste all of the code.

      Delete
  4. It's the best time to make some plans for the future and it is time to be happy.
    I have read this post and if I could I want to suggest you few interesting things or
    suggestions. Maybe you could write next articles referring
    to this article. I want to read more things about it!

    ReplyDelete
  5. I truly appreciate this post. I have been looking all over for this!
    Thank goodness I found it on Bing. You've made my day!
    Thanks again!

    ReplyDelete