Saturday, October 6, 2018

Day 22: Let's talk classes - in Processing

AP CSA
Today we did an introduction to classes but with a programming focus.  I did this with all students.

I have a student in my 6th hour who is really doing independent study but knows a TON about Java.  As he left the room yesterday from my Mr. PotatoHead adventure, he said "I just don't think they (the students) get why you would use a class yet."  He was right.  Today we made that happen.

In processing, students always ask me "how do I make a circle"?  Really, they just make an ellipse, but this provided a good opportunity to talk about the "circle" class.

Together we developed a set of attributes a circle can have.  Some students mentioned "area" or "perimeter" as attributes, I threw those in as methods since we could derive them from the attributes.

In 6th hour, I had a method called grow(int amt) that made my circle increase a radius by an amount.  When we instantiated our circle in the runner class, students could see what the actual circle looked like in Processing.

Here was our runner class:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
// runner class
// main method things - typically a runner class
Circle keegansCircle = new Circle();
Circle myCircle = new Circle(52, 100, 150);

public void settings(){
  size(500, 500);
}

public void setup(){
  keegansCircle.display();
  myCircle.display();
  
  System.out.println(myCircle.toString());

}

public void draw(){
  myCircle.grow(10);
  myCircle.display();
}

Here was our Circle class
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Class header
public class Circle{
  
  // class variables
  private float radius;
  private float xLoc;
  private float yLoc;
  
  // Constructor(s)
  
  // no-parameter constructor (default constructor)
  public Circle(){
    radius = 10;
    xLoc = 50;
    yLoc = 50;
  }
  
  // parameterized constructor
  public Circle(float r, float x, float y){
    radius = r;
    xLoc = x;
    yLoc = y;
  }
  
  // other methods
  public void display(){
    ellipse(xLoc, yLoc, radius, radius);
  }
  
  // setter or mutator method
  public void setRadius(float r){
    radius = r;
  }
  
  public float getArea(){
     return (float)(Math.PI * radius * radius); 
  }
  
  public String toString(){
     return "This circle has a radius of " + radius + " and a area of " + getArea(); 
  }
  
  public void grow(){
    radius = radius + 1;
  }
  
  public void grow(float rate){
    radius += rate;
  }
  
}

Here was the output:



We finished up the lesson with a "class foldable" which broke down the different vocabulary we saw that day.  Having the benefit of writing this post later in the week, I think I have seen these yellow foldables out almost every day.  Students use them and find them helpful.



AP CSP
Color Pixelization Widget!!!  I walked students through the first 3 challenges and introduced Hex.  Some students were very lost.  I think it would have been better to start with a blank screen in each of the 3 challenges and then re-created the pre-created colors.   For the second challenge (getting shades of a color) I had students do that themselves and then we debriefed it with a "secondary color" like yellow, cyan, or magenta.  That was a good activity to make sure students understood the content.

Also, for the third challenge, many students tried just doing "shades" of red.  I challenged them to make a "maroon red" an "orangey red"  a "magenta" - try to get DRASTICALLY different colors than just shades of the same color.

For the 5th "observation" students see that switching the bits per pixel ends with 2 bees.  It seemed like a "oh... huh" moment, but today my co-facilitator showed me this unplugged explanation of the 2 bees.  Essentially she drew a smiley face and then cut it into strips and put them next to each other like this...



... I thought it illustrated the point so beautifully.

Geometry
I have been thinking a lot about how to help geometry students be successful.  I think I am done giving them homework work time.  They don't use it.  If I make them do problems on the board, they do it.  That is practice.

I also have tried doing "one of each type of problem" from the homework together.  So then it becomes like a semi-collaborative-guided homework work time.  That might seem to work best.  Students also feel like they are getting "free answers" which is fine.

Today we re-learned some basic "here is what makes a triangle" sort of things.  I gave students an "exit ticket" to do on a whiteboard and told them they would get their homework after they were done with the problem correctly - this got good participation and students were eager to get it done and I was forced to see where each student was.

One Good Thing
I was comparing notes with another teacher about a student we had at separate times.  I have the student now, this other teacher had the student last year.  The student is one of my top participators in class.  They throw out ideas and seems engaged each day.  This teacher was surprised to know that since that wasn't the teacher's experience with the student in the year prior.  Sometimes I feel like we get frustrated that students do the same unproductive behaviors time after time, it was cool to see that this student had made progress over the prior year.  It also gave me motivation to tell the student "nice work" with participating.  I assume that is a new comment to the student which I think contributes to their self worth in class.

No comments:

Post a Comment