Category Archives: Education reform

Parsons Problem Lesson: quad_functions

Learning Programming is Hard

Many challenges face the new Computer Science learner. One of the most interesting times for students learning to program is that period after they’ve learned a new feature or programming strategy, but before they’ve had a chance to really master it. The syntax may still be unfamiliar, or the strategy is “the same, but different” as something that they’ve seen before.

A Parsons Puzzle

I first stumbled upon the “Parsons Problem” type of question in a paper by researchers Denny, Luxton-Reilly, and Simon, Evaluating a New Exam Question: Parsons Problems, published in 2008, which led me to Parsons and Haden’s original paper Parsons’ programming puzzles: a fun and effective learning tool for first programming courses.

A “Parson’s Puzzle” is a programming problem delivered via computer, in which code fragments, manipulated via a drag-and-drop interface, may be assembled to form a correct, working program. Clicking a “Check” button would provide some sort of feedback. Parsons and Haden proposed that the nature of the puzzle would improve engagement with the topic, provide better structure for students still struggling to understand fundamental logic, strategies, or algorithms, and even intentionally allow for common errors so that a student could get immediate feedback on fundamental misunderstandings.

Parsons and Haden’s original idea of helping to teach students with an automated system was adapted to a paper-based means of assessing students by Denny, Luxton-Reilly, and Simon. Along the same lines, it’s certainly possible to use a paper-based strategy of helping students develop and clarify their thinking on any given computer programming topic.

A Paper-Based Parsons Problem in the Classroom

In an introductory computer science course taught using Python, students had recently learned about functions, and had had the chance to learn how to use functions in several different contexts. Students were paired randomly and given a paper copy of the activity here [PDF], and asked to a) arrange the lines of code into strips of paper that they would assemble into a working version of the program, and then b) enter their code into the computer to verify that it works as intended.

"""
quad_functions.py
This program solves quadratic equations using three functions:
* one function to get the coefficients a, b, and c
* one function to calculate the two roots, and
* one function to print out the results
@author You
@version 1.0
"""

def get_coeffs():

def get_coeffs(a, b, c):

def calculate_roots(a,b,c):

def main():

def calculate_roots():

def display_solutions(root1, root2):

def display_solutions():

main()

a, b, c = get_coeffs()

root1 = (-b + (b * b - 4 * a * c) ** (1/2)) / (2 * a)

root2 = (-b - (b * b - 4 * a * c) ** (1/2)) / (2 * a)

x, y, z = get_coeffs(a, b, c)

display_solutions(r1, r2)

return root1, root2

display_solutions()

display_solutions(a, b, c)

print(root1, root2)

return a, b, c

print("The solutions are: ")

a = eval(input("Enter coefficient a: "))

b = eval(input("Enter coefficient b: "))

c = eval(input("Enter coefficient c: "))

r1, r2 = calculate_roots()

a, b, c = get_coeffs()

r1, r2 = calculate_roots(a, b, c)

if __name__ == "__main__":

#!/usr/bin/env python3

Observations

Students took the assignment seriously, and seemed to appreciate the nature of the puzzle, and the fact that all of the information was available to them—they just had to (literally) put the pieces together. There were some lively discussions—”Do we need a function header with parameters or not? Do we need the function to return a value or not?”—as well as a desire to get done with the puzzle-solving as quickly as possible in order to move onto entering the code into the computer to test their program.

For a larger assignment or project with many variations, the Parsons approach is not well-suited: there are too many variations that need to be considered. For students just learning to master a new topic, however—functions, conditionals, while-loops, for-loops, etc—the Parsons Problem strategy is a great way to build students’ skills and confidence in programming.

References

Paul Denny, Andrew Luxton-Reilly, and Beth Simon. 2008. Evaluating a new exam question: Parsons problems. In Proceedings of the Fourth international Workshop on Computing Education Research (ICER ’08). ACM, New York, NY, USA, 113-124.

Dale Parsons and Patricia Haden. 2006. Parson’s programming puzzles: a fun and effective learning tool for first programming courses. In Proceedings of the 8th Australasian Conference on Computing Education – Volume 52 (ACE ’06), Denise Tolhurst and Samuel Mann (Eds.), Vol. 52. Australian Computer Society, Inc., Darlinghurst, Australia, Australia, 157-163.

Pair Programming

As a Science teacher I am well-acquainted with the idea of students working as partners in a lab setting. It’s a time-honored practice based on a variety of rationales, depending on the setting. Lab partners, or indeed partners in any academic setting, might be placed together for logistical reasons: there may be multiple responsibilities that need to be shared, there may be limited equipment, limited lab supplies, limited computers, or limited space. There may be pedagogical reasons as well: students can assist each other in learning material, or learning to work together may even be the goal of the lesson.

In computer programming classes, “pair programming” may be used, with one student typically “driving” (entering code on the computer), and another “navigating” (dictating code, catching typos, etc.) There are variations on the specific responsibilities of each role, but the general idea is that two heads are better than one, and that an ongoing conversation as the code is developed will produce a stronger product. Pair Programming isn’t just for classes–it’s actually used in the software industry by some organizations.

Regardless of the context, there are bound to be challenges when two people are asked to work together in a demanding situation. One common challenge is when two students have varying abilities or levels of success. Sometimes teachers will even pair students with this in mind, either placing students of similar level with each other, or pairing a successful student with a challenged student with the hope of fostering some impromptu peer tutoring. (I’d suggest that there are issues with both of these strategies, but we’ll leave that for another time.)

In my courses I’ve developed a Pairing Strategy that seems to be working well for my students based on the success I’ve seen in their assignments and their behaviors in the classroom. It works like this:

1. Introduce the idea of Paired Work.
Discuss the benefits and talk about the challenges. Mention the fact that there may be different roles to be played, and that those roles will likely change over the course of the experience.

2. Discuss behavior.
Point out that people need to be on their best behavior when working as a pair. Respect is an important part of this process, and that includes during that first moment when you learn who you’re going to be working with. A loud cry of “Oh, man, I got stuck with Christine??!” doesn’t get you off to a great start, and celebrating that you got paired with the person with the highest test average isn’t appropriate either.

Code.org’s video on Pair Programming, while a bit cheesy and clearly intended for a more Middle School audience, pretty much nails it.

3. Explain the Pairing process.
Very often I’ll use this computer program to pair students randomly. They’ve come to appreciate the excitement of finding out who they’re going to be working with.

In the case of Pair Programming, I’ll be very specific. Just before running the program so that students can see the results on the overhead projector, I’ll say that the partner listed on the left side of list will be the first “driver,” and that students will be using that person’s computer for the project. The person listed on the right side of the list will be the navigator, and will get up and move over to where the driver is sitting to get started.

#!/usr/bin/env python3

"""
random_partners.py
This program takes a list of students in the class and assigns them randomly
to a series of groups of a specified size.
@author Richard White
@version 2018-10-10
"""

import random,os

def main():
    all_students = ["Kareem","Lucas","Marcela","Dylan","Gwen","Ella","Adam","Carrie","Patty","Annie","Audrey","Aidin","Sinjin","Henry","Robby","Sean","Ms. Dunham"]
    students_present = ["Kareem","Lucas","Marcela","Dylan","Gwen","Ella","Adam","Carrie","Patty","Annie","Audrey","Aidin","Sinjin","Henry","Robby","Sean","Ms. Dunham"]
    os.system("clear")
    groupsize = eval(input("Enter # of people in a group: "))
    os.system("clear")
    i = 0
    print("PARTNERS:")
    while len(students_present) > 0:
        if i > 0 and i % groupsize != 0:        # Print commas after first one in group, 
            print(", ", end='')                 # but not if done with group
        random_student = random.choice(students_present)    # Pick random student
        print(random_student,end='')
        students_present.remove(random_student)             # Remove name from list
        i += 1
        if i % groupsize == 0:
            print()             # Space down at end of members
    print()

if __name__ == "__main__":
    main()

4. Run the program
Here’s a sample run from running this program in my Introductory Computer Science course:

PARTNERS:
Robby, Adam
Kareem, Aidin
Ella, Annie
Henry, Patty
Gwen, Ms. Dunham
Lucas, Carrie
Dylan, Audrey
Sean, Sinjin
Marcela

5. At an opportune time, have students exchange roles.
During every assignment, assuming I’ve done a good job of building in an unexpected challenge or new idea, I’ll ask for attention: “Hands off the keyboard!” or something similar. I’ll pose a question regarding the work that they’ve done, or share some observations I’ve made, or ask if anyone has come across the difficulty that I’ll expect they’re going to have. After this brief interruption, I’ll ask them to change roles and continue their work.

Sometimes the process doesn’t work quite right the first time, or there may be mid-course corrections required if students get a little sloppy in their treatment of each other. That can happen in any classroom environment. The fact that students are truly randomly assigned, however, seems to keep them on their best behavior. They know that I don’t have any intentions in assigning them to a given partner–this is just who they’re going to be working with today.

Here’s a video clip of my students working on a programming assignment in a Paired environment.

Overall, I’ve been very pleased with how this process has worked with my students over time. Give it a try in your classroom and see what you think!

The Growth of CS Education at My School

by Richard White

2018-04-22

I’ve worked at four different high schools in my career as an educator, and taught computer science courses at two of them. I was the lone CS teacher at those schools, as are many of us. It gives us a lot of freedom in some ways, but it also makes teaching CS a bit lonely sometimes: as a science teacher, I enjoy lunchtime conversations with colleagues in that department, and benefit from having a colleague who teaches the same course I do (AP Physics C).

Computer Science is different. It’s not what many teachers consider a “core competency,” I don’t have a department chair to advocate for me, and having a single teacher of that subject implies that the classes offered by the school are limited to subjects with which I have some familiarity: I am comfortable offering an Intro to Computer Science course in Python, an AP Computer Science A course, and an Advanced Topics in CS (data structures) class, but I don’t offer classes in mobile application development, networking, or game development.

After several years of encouraging the school to increase the number of sections of CS offered, I am so excited that we made the decision to hire someone for a Math/CS position, and that I’ll soon have a colleague with whom I’ll be sharing CS teaching duties.

It’s a time of transition for the school, and for me as well. I’ve never had a CS colleague before! The courses currently offered at the school have all been designed by me, and taught by me for so long that I suppose I might be forgiven for being a little possessive of them. And yet (at this point, anyway) I don’t feel too worried about that.

It may help that I’ve seen our new hire teaching a CS class and I appreciated the way he worked with the students. Or maybe I’m just looking forward to having conversations with a colleague with whom I can discuss curriculum ideas, teaching strategies, projects, etc.

This new hire is relatively young, and although he has a decent amount of experience programming in a variety of languages, this will be his first experience formally teaching CS.

At this point, the challenge facing me is this: how do I share what I’ve done with these classes with the new teacher?

  • Course description? (of course)
  • Course syllabus?
  • Course calendar from last year?
  • Lesson plans?
  • Activities and projects?
  • Assessments (tests, quizzes)?
  • Teaching strategies?

I’m happy to share some/all of these things, but it’s also important for a teacher to be able to develop their own materials, and find their own way of teaching a class. I’ve worked with student teachers in the past, and giving them the freedom to find their own pedagogical identity is one of my favorite parts of that experience.

We’ll see how it all works out! In the meantime, I’m just so pleased that my school–a relatively small, independent institution–recognizes that providing CS experiences for as many students as possible is increasingly important.

No Textbooks for my Courses Next Year

tl;dr

I will not be using traditional, bound, textbooks for my classes next year. Instead, students will be using a combination of reading materials provided by the instructor, reference materials available online, and open source publications.

Complete text

Teachers have been asked to turn in a list of textbooks that will be used in their courses next year. This will be the first year in my 32-year teaching career that I will not be working from a traditional textbook in any of my classes.

This isn’t as big a step as it might sound, and it may be that I am in a somewhat unique position to be able to do this. For the past two years I have taught four different courses, and it is for those courses that I am making this decision.

Course-by-course analysis

AP Physics C: Mechanics, and Electricity & Magnetism

Textbooks for this course have, for a while now, been problematic. I’ve been very pleased with the textbook we use, but it’s large, heavy, and cost $411 on Follett last year. The homework problems that Craig and I assign have to be adjusted every time a new edition comes out–an increasingly frequent event–and the solutions that we provide to students have to be redone as well.

The topics of “classical” physics have not changed to warrant this kind cyclical upheaval. The cynical/realistic view of the race to release new editions is that publishers benefit when a course’s new textbook can’t be replaced by the old editions that students resell or pass on. Digital version of the book are almost as expensive and have a limited life-span: access to the digital version expires at the end of the course, and even for physical textbooks, publishers remove access to the textbook and its ancillaries once some number of years have passed–students and instructor can no longer access online materials for our 2010 8th edition of Serway & Jewett’s Physics for Scientists and Engineers.

Somewhat related to the expense issue is the question of how useful students found the text. Although I have provided references to the appropriate sections of the textbook that students can refer to as a supplement to classroom discussion, student evaluations of the textbook suggest that most students use the text primarily as a reference for homework problems–they don’t use the textbook as much for learning the content itself.

(Note: A quick glance at the Cengage website reveals that prices have come down on the 10th edition of this text. This helps to address one of my concerns, but not the others.)

I should also mention that there has been a black market version of this text, a PDF version that students have shared among themselves. While I applaud their resourcefulness, I can’t condone that strategy, and certainly can’t distribute the PDF myself, nor suggest that this is how they should acquire learning materials for our course.

The solution that I have promoted to our physics teachers is an open source one: the OpenStax organization, a non-profit based at Rice University, has published free, downloadable, textbooks (in PDF form) that students can install onto their computers. Student solution guides (PDF) are available for these textbooks as well. Printed versions of the textbook are available for a reasonable price ($48.50). These textbooks and the ancillary materials are being released under a Creative Commons license that allows for free distribution of this resource.

This solution checks all the boxes for us: free, easy-to-use (as a PDF on BYOD devices), distributable by us, and non-expiring. It’s a solid, long-term solution to a long-term problem.

Advanced Topics in Computer Science

This is the third year we’re offering the Advanced Topics in Computer Science course. The book we use for this class–Problem Solving with Algorithms and Data Structures, at $45, isn’t expensive as textbooks go, but the author and publisher have been kind enough to make available a free online version of the text as well. There are minor differences in the two texts, so this year, I began using the online version for class exclusively.

Although the printed version of this text is released under a traditional copyright, the online version has been made available as an open source document: “Problem Solving with Algorithms and Data Structures using Python by Bradley N. Miller, David L. Ranum is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.” This license explicitly allows for one to “copy and redistribute the material in any medium or format.”

What does this mean for students? I have made a copy of the online (HTML, browser-based) version of this text, and am free to make it available to students as a resource for this course. (They may use the online version as well.)

A copy of the Miller & Ranum text displayed locally in-browser

AP Computer Science A

This is perhaps the most challenging text to replace. As with physics textbooks, there are plenty of Java textbooks available, but not all of them focus on the AP Computer Science subset of material, and the ones that do exist tend to suffer from the same, multiple-editions, “re-publish early, republish-often” challenge.

In the past we’ve used the most recent version of Cay Horstmann’s excellent Big Java: Early Objects, Interactive Edition, 6th Edition, but Follet for the past two years has stated that supplies of that textbook are endangered. The Introduction to Computer Science using Java by Bradley Kjell is an online reference, updated in 2017 and released under a Creative Commons Attribution-NonCommercial 4.0 International License. While this reference doesn’t (to my reading) have the narrative flow of Horstmann’s work, it does have the benefit of being available, free, and electronic.

As an instructor with growing experience in this course, I’ve been doing what many teachers do after a few years under their belt: I’ve started to use more and more of my own materials in the course. The BankAccount class that Horstmann favors is one I find students don’t understand as well, perhaps, as the Car class that I created for them the first year I started teaching it. Exercises, activities, projects, and review activities are increasingly my own, and this is the year that we’re going to walk away from the Horstmann textbook.

Intro to Computer Science

The *Introduction to Computer Science* course was the first Computer Science course (in recent history) that I began teaching at Poly, and the one for which the curriculum is most my work. This elective course has used another Franklin Beedle offering by John Zelle, the excellent Python Programming: An introduction to computer science. At $45 it’s another reasonably-priced offering.

It’s another book, however, that students don’t seem to spend much time reading. It’s an occasional reference, perhaps, but many of the materials used in the course now are materials drawn from my own experiences teaching that course over the years. As with all the classes, I post online materials that we develop during discussions—indeed, those materials are what is displayed on the board as I present in class—so this textbook, perhaps, is the easiest one to walk away from.

Online lecture notes written by Richard White for the Intro to Computer Science course

I’m a special snowflake

The fact that I’m able to consider dropping traditional textbooks at all is due in large part to a nearly unique set of circumstances:

  1. I have a personal history of posting materials online

    My Masters in Education included an educational technology component, and since that time I’ve made it a point to put as many of my educational resources online as possible. Whether coding a website by hand or using a Content Management System (WordPress is great), I think teachers should put as many of their materials online as possible. The fact that I’ve been developing materials for my own courses for such a long time as part of that process has placed me in a better position to continue that online-publishing process.
  2. Science and technology books are appearing online
    Where I am not using content developed by myself, I am using online versions of textbooks that have been made available by others. Different fields and subject areas are putting Free and Open Source (FOSS/FLOSS) materials online at varying rates, with Science and Technology leading the way. Without ready access to those resources, this would be a much more difficult process.
  3. Open source movement
    In turn, the idea of making materials available online is thanks in large part to the [open source movement](https://en.wikipedia.org/wiki/Open-source_model). From Richard M Stallman’s GNU Project to Lawrence Lessig’s Creative Commons organization, people are starting to formalize the processes that teachers have used for years: sharing materials developed for their own students with other teachers. I also got a big kickstart in thinking about this possibility by Red Hat’s Tom Callaway who gave a powerful presentation on Education and Open Source at the 2016 Southern California Linux Expo.

What happens next?

Materials for my courses will be available online at crashwhite.com, and the process documented at hybridclassroom.com.

CS for All?

There was an interview last month with the governor of Rhode Island, Gina Raimondo, posted at http://freakonomics.com/podcast/modern-democrat-win/. The governor sounds like an eminently reasonable person (to my political sensibilities), and at one point in the conversation, to subject of Computer Science came up.

From the posted transcript:

DUBNER (Interviewer):
In terms of preparing the populace for the labor scenario that’s coming down the road, I know you’ve been pushing to have every student in Rhode Island take computer-programming classes. Is that a thing already?

RAIMONDO: It’s happening now. We set a goal, I think a year or so ago, that by the end of this year we would be teaching computer science in every district and every grade, starting in kindergarten. And we’re going to hit that goal this year.

DUBNER:
So, I hear about this kind of thinking a lot, and I certainly understand the appeal and the resonance. But I do also wonder if there’s a proven upside of having everyone learn computer science or programming. It strikes me a little bit like the equivalent of having every student in America during the boom of the internal combustion engine learn to take apart a carburetor. And then I think, if you look at the history of economics and progress, that one of the main strengths of economic progress is the division of labor and specialization, rather than everybody chasing after the latest trends. So I’m curious what the evidence was that inspired that move of yours.

RAIMONDO:
I think of it as access and exposure, and also just providing people with a basic level of essential skills. So, everyone has to take math. They may become a writer, they may become an actor, but they ought to have a certain basic level of math skills. First of all, because it’s an essential skill to function. And by the way, they might like math. I think digital skills are the same thing. No matter what job you have, you have to have some basic familiarity with computer skills and digital skills. And so it is as essential in this economy as any other skill that we teach. But also, we know — and there’s loads of data on this girls, people of color, and low-income folks are less likely to go into I.T. fields, which tend to be higher-paying. However, if they’re exposed to some computer training, they’re much more likely to go into the field and do well at it.

“Access and exposure.” That about sums it up. Without even weighing in on the question of whether or not students should be required to take computer science, how do we go about providing them with “access and exposure” to this subject?

There’s some degree of irony in all of this given that most of us who are computer scientists now never had anything close to the degree of “access and exposure” students have available to them now. My “first computer” was a teletype with a modem link to a PDP-11 at the local hospital, and we were lucky to have it. (Cue the obligatory reference to Monty Python’s “Four Yorkshiremen” sketch, at https://youtu.be/26ZDB9h7BLY.) Today, students have access to smartphones, inexpensive laptops, even Raspberry Pis, and more YouTube tutorials that you could hope to watch explaining how to program, how to develop, how to download…

It seems to me that students do have access, but the exposure is what’s missing at this point.

And that’s where CS teachers can be most valuable.

For those of you who teach at the high school level, does your school require a Computer Science class for graduation? What do you think of the idea of requiring Computer Science for graduation–yea or nay?

Implementing a Post-AP Computer Science Course

Implementing a Post-AP Computer Science Course

by Richard White

2017–06–06

This past semester I began teaching an “Advanced Topics in Computer Science” elective that I’d developed for my school. It’s an interesting class for a number of reasons.

  1. Although it was a new class for me, the topics covered in the course aren’t new to longtime high-school teachers who taught the College Board’s old AP Computer Science AB course back in the day. The “B” part of that course included discussions of some of the topics covered in this elective, including various types of more complex data structures and algorithm analysis. The “B” part of the course was discontinued in 2009 in an effort to “focus resources on efforts that will provide a much greater degree of support for AP Computer Science teachers than ever before.” [1] (Yes, I don’t quite follow the logic there either.)

  2. The class was offered as a “post-AP” course. In the context of my school, there are a wide number of students who are interested in learning some computer science, and who are more-than-happy to earn some AP credit for it. Most of them are not going on to study CS, however, so this class filled a need for those students. The impetus to develop the class came mostly from me, informed by some encouraging prodding from alumni.

  3. Although the standard AP Computer Science A course uses Java (currently), I wanted students in this elective to focus on the data structures themselves, without having to muck about with Java infrastructure. I elected to offer the course in Python, and this had a number of implications.

    1. For students who really were taking this after the AP CS course, they needed to learn Python, and fast. A year of Java had given them a solid grounding in object-oriented strategies, but the Python syntax and quirks like dynamic typing took some getting used to. The Advanced Topics class, then, began with a Python-based Boot Camp to bring everybody up to speed.

    2. There were a couple of students who chose to take this class after completing a single-semester Python class. This required a bit of a stretch on their part: although they were well-versed in Python syntax, they had been learning CS for a shorter period of time, and weren’t as well-grounded in object-oriented thinking. The Boot Camp strategy attempted to bring them up to speed, but was no substitute for the more extensive curriculum in the AP Computer Science A course.

  4. The class was initially developed as a way of returning to the curriculum that was originally offered by the College Board program, and can be viewed as supporting that model. I have since had a number of conversations with teachers and administrators who see this course as a potential model of what a rigorous class might look like as part of a non-AP program. That wasn’t my intention in creating this course–I actually appreciate the idea of a national-standard curriculum against which my students can gauge their mastery–but this course can certainly serve different needs, depending on context.

  5. As we worked our way through the curriculum, I tried to be sensitive to the experience of the students. Developing Python implementations of stacks, queues, trees, and graphs isn’t everybody’s idea of a good time, so I worked to include offshoot activities that built on the skills they were learning. This can be especially challenging the first time a course is offered (and I was teaching this class as an overload), so I expect next year is going to be a much more satisfying experience for the students. Abstract structures may be developed with visual representation, for example, bringing a more graphic appreciation of the structures.

I wasn’t too unhappy with how things worked out this first time through, but I’m looking forward to refining some aspects of the course and smoothing out some of the rough edges in anticipation of offering it again next year. In the meantime, you can see the webpage for the course at Advanced Topics in Computer Science.

I’ll be writing a bit more about this course in the next month or so. Stay tuned.

Three Lines of Code

Three Lines of Code

2017-04-29

by Richard White

Earlier this week I was walking through a school hallway when one of my students called out to me. “Mr. White! I’ve got a program that calculates primes in only three lines of code!”

I laughed, and asked him to bring it to me later in the day so that we could look at it.

“It’s just three lines!” he exulted, as if I might not have heard it the first time, “and one of those is a print statement!

Jack had taken an introductory Python course from me during the first semester of the school year, and from there had decided that he wanted to take the post-AP “Advanced Topics in Computer Science” course, a more abstract computer science curriculum that focuses on various types of data structures. Enrolling in this course requires my approval, and I had some initial concerns about how Jack might do in the course: He just had a few months of experience, and the curriculum would be a significant step up for him. While I didn’t want to set him up for failure, I didn’t want to dampen his enthusiasm for the subject either. In these situations, I try to err on the side of saying ‘yes.’

This semester Jack has had occasional struggles in the course, but so have most of the students, a fact that one could easily chalk that up to this being the first time I’ve taught the class. In any event, he’s making fine progress, and this prime-finder activity that he’d taken on for himself wasn’t the first time I’d seen him take something from outside the class and turn it into a piece of code.

Jack tracked me down again after school, laptop already open, ready to show his code. And sure enough, there it was, a tiny little Python program of just three lines. And it worked!

“What kind of algorithm is this?” I asked. It wasn’t the standard introductory comp sci treatment of primes I used in my teaching.

“This is ‘Wilson’s Theorem,'” he explained. “I learned about it on YouTube. It’s not very good for large prime numbers because it requires calculating factorials, but still… three lines of code!”

I thought about it for a moment.

“I bet we could get it down to one!”

“How?”

“Do you remember Python’s ‘list comprehension’ syntax? I bet we can use that to make this a one line program that calculates primes!”

And so we did.


Last login: Sat Apr 29 09:05:01 on ttys000
rwhite@MotteRouge$ python
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> [x for x in range(2,1001) if (math.factorial(x-1) + 1) % x == 0]
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
>>>

Just about every teacher I know would have his or her own lesson to be learned from this anecdote. It could point to the need for more free time in school so that students can find their passion. It could be a call for more open access to teachers before and after school. It might be a testimony to more open access to advanced classes, or an encouragement to allow more students to take academic risks. A math teacher might read it as a need for us to teach more computer science in our math classes, and a computer science teacher might claim that this demonstrates the utility of Python as an educational programming language.

There’s some truth in all of those, I think. Every educator would like to find more ways to empower our students to find and follow the interests that inspire them. Some students find their passion more quickly or easily then others, but every parent knows the secret to helping kids flourish and grow: throw stuff at them and see what sticks. Comic books. T-ball. Educational television. Piano lessons. Board games. AYSO soccer. Summertime concerts. Bedtime reading. Camping trips. Scissors, tape, and construction paper. Play dates. Museum visits. An allowance and an introduction to budgeting. An electric guitar. A woodworking class. Batteries and wire. Dance lessons…

Give students time, space, exposure to new ideas, and the tools to build on those ideas, and they’ll find something that inspires them.

Differentiated Instruction, Part 2

DIFFERENTIATION, part 2

2017-03-11

by Richard White

I was recently asked by our IT director John Yen how I handle differentiated instruction in the classroom: what strategies do I employ to try to ensure that students of widely varying abilities and skill levels are all appropriately challenged in my courses?

It’s a question that public school teachers face all the time, and independent school teachers arguably somewhat less. Technology teachers at both types of institutions have the biggest challenge here, because:

  1. there isn’t (yet?) a standardized curriculum path that has been developed and accepted around computational thinking and computer science, and
  2. there is a large, and perhaps growing, “digital divide” between those students who have nearly unlimited access to technology and training (even informal training via YouTube videos and the internet) and those who don’t.

My reply to John’s question took a little while to narrow down to a response to his questions, but here are my remarks, lightly edited for clarity.

=====Beginning of Email=====

  • That’s one of the million-dollar questions right now: How do I bring students with widely-varying experience into the curriculum?
  • The 2-million dollar question is: What CS curriculum do we want to offer/require? This varies depending on the school population, the goal of the curriculum (CS for managers? Coding for vocation?), the instructors available, the budgeting, salaries…
  • The 3-million dollar question is: Who is going to teach this curriculum? At this point, that is going to have an overwhelming influence on the other questions. CS people don’t do much with game design, and Game Designers don’t know a lot about Linux, and software engineers may or may not know about networking or control systems…

In Computer Science courses, I’ve found that I often have to provide up to five different kinds of differentiation, given at different times according to the idealized schedule given here.

Steps in Assigning/Conducting a Computer Science activity or project

  1. I prepare the assignment, preferably on paper or online so I can check that the idea and the process are fully articulated. NOTE: When looking through some online references a few years ago I stumbled upon an assignment format used by professors at Michigan State University, and I’ve adopted it for many of my CS courses. An example is attached here.
  2. During the preparation of the assignment, I try to prepare 1-3 Extension activities that are more complex or require application of the project to a new context. This is the first differentiation that I’ll use with some of my more advanced students who would otherwise complete the assignment too quickly. On the assignment I also often include a section called “Questions for you to consider (not hand in)” which ask the students to think about other aspects of the subject that may not be directly related to the assignment. These can be a nice jumping-off point for a conversation with more advanced students.
  3. Also for the assignment, I prepare a few “Notes on Getting Started” that are included with the instructions. These notes include suggested work strategies and/or questions that might help clarify the direction their problem-solving process should take. This is the second differentiation.
  4. Deliver the assignment (paper or online) in class, with whatever introductory remarks are appropriate. Students begin working.
  5. After students have been working on the assignment for some length of time, I’ll usually check in with them to see how things are proceeding so far. If there’s a stumbling block in the assignment that I’m aware of, I may bring it up at that time, and ask them what they think about it. I’ll usually write some amount of code on the board here, developing ideas with those students who have become stuck. This is the third differentiation strategy. ( Example: This video (narrated) of me working with students in class: https://www.youtube.com/watch?v=ZJ3z51n1Ndo )

    If I notice that a number of students are having difficulties with a concept or problem, I may prepare a small video for them going over the issue in more detail. I’ll post the video and send the link to them so they can take another crack at it. This is the fourth differentiation strategy. ( Example: This video, covering the topic of website permissions for some students’ websites: https://www.youtube.com/watch?v=sEES_N3ZQHk )

  6. Ultimately some students will need more individualized attention, sometimes down to the point of sitting down with them individually and picking through their code line by line. This is the most challenging and time-intensive differentiation strategy, and not something that I’m able to do with every student every time. Fortunately, if I’m doing my job well, I don’t need to do it very often.

=====End of Email=====

What strategies do you have for providing differentiated instruction for your students? What evidence do you have that those strategies are successful (or not?)

Is the Digital Divide something that needs to be addressed by CS teachers? If so, what steps do you take towards ameliorating that problem?

The Poor Person’s Guide to Differentiated Instruction

The Poor Person’s Guide to Differentiated Instruction
=====================================================

by Richard White

2016-10-28

I’m a classroom teacher, and I’m a busy man.

I prep lessons, I develop and coordinate assignments for my students, and post homework assignments on the school website. I collect work, set up labs, write, administer, and grade tests. I develop caring relationships with my students.

It’s the best job in the world… and I come home *exhausted* most days.

One of the many challenges we teachers face is providing learning opportunities that are appropriate for the level of our students. In classes with an especially wide range of abilities, these can become problematic, logistically speaking.

In my Computer Science classes I typically have at least three ability levels in the same class:

1. students who have already had some experience with programming, possibly in a different language, and who are able to accomplish most assignments very quickly.
2. students who may be new to programming, but who are making reasonable progress. They quickly learn that programming requires attention to detail, and they typically pick up patterns—syntactical, logistical, procedural—after one or two exposures.
3. students who struggle to recognize the patterns, or who find themselves more easily frustrated by the puzzles posed by programming assignments.

I’ve experimented with a few different strategies over the years. Here are three that I’ve tried that have met with some success.

1. Below the Fold Progression
In this type of differentiation, students are provided with a text file (usually online) that contains a statement of the problem at the very top of the file. The file itself is actually a working copy of the problem, with the initial problem statement written as a multi-line comment near the beginning of the file. Much farther down on the page, where students can’t easily see it without scrolling, is another multi-line comment containing a pseudocode analysis of the problem. And finally, much farther down again, is the solution code itself. Students who want to work out the program without any hints are free to do so, while students who need a bit of help from the pseudocode can look at that as needed. Students who need much more support may find themselves looking at the actual program for assistance, and that’s okay if that’s where they are in their own learning process.

Example: ch06ex03.py (Right-click or Ctrl-click to download)

2. Page 2 Solution
In this strategy, something similar to the “Below the Fold” method is used, but now, the problem statement and its solution are printed on paper to be distributed to the students. The front side of the paper has the problem statement, and a complete working version of the code is on the back side (page 2) of the same piece of paper. This has the advantage of giving the students a concrete document to scribble on, and giving the teacher some ability to see which side of the paper students are looking at as they work on the program.

Example: four_functions.py (PDF format, Right-click or Ctrl-click to download)

3. Progressive Lecture
The final strategy is much more interactive. Students are assigned a problem in class and instructed to begin developing a solution. At the front of the room, after some reasonable amount of time has passed, the teacher begins writing out a rough outline of the program, perhaps with comments highlighting significant sections of code. Students who have developed their own solutions to the program will continue working on their own, while those who may be struggling to organize a solution will get some hints from what is written on the board.After a few more minutes have passed, the instructor may continue fleshing out the solution to the problem using the framework already developed. Students who still aren’t sure about some aspects of the program are free to ask questions as actual code is presented on the board.

Example: Differentiated Instruction (YouTube video)

Strategy 3 requires the most from me in the classroom. I’m moving around the room, actively monitoring students’ progress, and trying to determine the *decisive moment* (thank you, Henri Cartier-Bresson) when I should begin reaching out to assist students who need some additional guidance. Strategies 1 and 2 have the benefit of being delivered by computer or paper, with assistance immediately available to students when they decided they want to take advantage of it. The downside of those two strategies, of course, is that students do have access to solutions, and may be tempted to avail themselves of those materials before they’ve had a chance to wrestle with the material… and it’s in that wrestling that they really get to learn things.

As I say, I’ve used all three of these strategies on one occasion or another, and they work pretty well in Computer Science courses. I’ve adapted similar strategies to some of the science courses I teach.

As a teacher, do you use any of these strategies, or something similar? How do you reach out to the students of varying ability levels in your classroom?

The Lone Wolf… Rides Alone

The Lone Wolf… Rides Alone

Richard White, 2016-10-15

Computer Science teachers at the 9-12 grade level are a lonely group of individuals in many cases. Some of us have colleagues nearby with whom we can converse with on a regular basis–there might even be a computer science program or department at our school–but many of us work alone, and represent the sole face of *Computer Science instructor* at our schools.

Some people enjoy the freedom that comes with being the “lone wolf” of the school’s Computer Science program. You have a bit more control of the curriculum you teach, perhaps, and conflict resolution with peers goes a whole lot easier when you don’t *have* any peers.

But there are challenges as well. Many of us are responsible for wearing multiple hats simultaneously, managing hardware, software, and curriculum, for example. Or we teach separate classes in widely varying topics: computer science, networking, web design, and mobile application development. In addition to our courses, we mentor robotics teams, we advise Girls Who Code clubs, and we organize “Hour of Code” events for the larger community. We promote Computer Science as a subject internally to our peers and administrators, and act as *de facto* Public Relations representatives to the wider community.

It’s no wonder we get a little tired sometimes.

With an increased interest in computer science, computer principles, and computer programming, there’s a call for more computer science teachers nationwide.

For me, it can’t happen to soon. As much as I’ve enjoyed developing and teaching computer science classes at my school, I could use a little company.

What’s your preference? Do you enjoy working alone, or is the idea of bringing in someone else to share ideas and share the labor appeal to you?