Category Archives: Teaching

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?

My Vision

MY VISION

by Richard White

2016-03-24

You almost certainly heard that a couple of months ago, President Obama called for “Computer Science for All” in a program of the same name. From the Fact Sheet for that initiative:

Providing access to CS is a critical step for ensuring that our nation remains competitive in the global economy and strengthens its cybersecurity.

We’ll set aside (for the moment) Obama’s more recent call to weaken that cybersecurity that he’s such a fan of. In the larger perspective, Obama is correct: we need to provide more opportunities for students to learn Computer Science.

I think he gets this just right. This statement doesn’t say students must take CS classes. This is not necessarily a requirement. But the vast majority of students probably should take one or two CS classes, and certainly everybody should have the opportunity to take CS classes.

When people ask me about it now—the Vision question—this is part of my thinking:

I don’t think every student should be required to take Computer Science. But every student should take Computer Science.

They should recognize that computers, technology, the internet, social networks, online advertising, and cybersecurity have an enormous influence on how they live their daily lives.

It’s certainly possible for a student to educate themselves, but we shouldn’t expect them to take that on alone any more than we expect students to teach themselves calculus or how to write a research paper. Schools offer instruction in these areas because well-educated citizens need to know about these things, or at least need to have been exposed to them in a structured setting.

What do you think? Should schools require students to take a CS course, or should they just offer the curriculum and see who shows up?

Networking, and Staying Social

Networking, and Staying Social

by Richard White

2016-03-01

I’m fortunate to work at a school where the faculty are very collegial. Even where there is occasional departmental or teacher-teacher friction, we tend, by and large, to get along. You might chalk it up to our “Welcome Back” and end-of-year dinner parties… or maybe it’s the post-faculty meeting margaritas that they serve us occasionally. Whatever the reason, I see a lot of personal and professional cross-pollination going on.

This kind of networking requires both time and an individual willingness to be open: to people, experiences, and possibilities. I often find myself locked up with lessons to create, labs and projects I want to design, and always, always, a pile of papers to grade. Finding the space for interactions with others necessarily means setting some of my work aside, at least for a little while.

This past August, for example, I should have been deep into prepping for the coming school year, but two of my English department colleagues had put together a weekend workshop on Transformative Teaching and Learning, to be offered at an open workspace in downtown Los Angeles. It was a great weekend with a diverse group of teachers, and if none of what we did was completely germane to my own subject area, I had the opportunity to reflect on other aspects of my teaching.

Oh, and did I mention the fact that I got to network with some of my colleagues in a stress-free environment? :)

One of my favorite things about networking—in addition to the inherent pleasure of socializing—is the fact that unexpected opportunities often arise as a result. A few months into the school year, one of the English teachers with whom I’d connected at the summer workshop approached me. “Hey, I’ve been asked by the school to write an article about language, and I wanted to talk to you about that.”

Insert confused looks here from the Physics/Computer Science teacher.

Language?” he said. “As in computer languages?” You’re a Computer Science guy, and I want to talk about language from a very global perspective!”

Huh. I’d never thought of that.

Next thing you know, I’m minding his infant daughter at a nearby pub while he grabs a couple of beers for us, and before long we’ve launched into a conversation on the role of language in various contexts.

And a month or two later, I found myself mentioned in his feature article in the school’s semi-annual publication:

Lighting up about language: Authoring across the curriculum

by Nathan Stogdill, in the Oak Tree Times, Fall-Winter, 2015

… Richard White sees a similar form of authorship in his AP Computer Science classes, where students create their own programs through syntax and conventions of coding languages. Like seventh-graders writing haiku or ninth grade math students telling the story of their solutions, his students have an outcome in mind and must work within the constraints of a specific language or instruction set to achieve that outcome. But there is creativity within those constraints, and the outcome is not assumed. Sometimes when the program is run, it does the unexpected. These surprises are exciting moments for White and his students: Like authors discovering new meanings through the process of writing, they find that they have created new things that they never intended, and they are able to learn from them.

Nathan makes me sound a lot smarter than I am, but I never turn down free publicity…!

Teachers tend to get pretty busy, and it’s easy to find one’s self spending a lot of time alone, frantically trying to keep up with our obligations. We take our jobs seriously, and we have high expectations, of our students and ourselves.

I believe that taking a little time off, however, benefits us in important and unexpected ways. Take a moment today or tomorrow to put your grading down, get out of your classroom or office, and stop in for a chat with someone. Go visit someone’s classroom for a few minutes. Check in with one of your admins.

You never know what might happen as a result!

140 Characters Is Not Enough

140 Characters Is Not Enough

2016-02-28

by Richard White

I’ll confess right here, I’ve only really ever been a lurker on Twitter. I’ve got a couple of accounts there, and I follow a few people, and appreciate the spontaneous ebb-and-flow of some conversations, memes, tropes, movements, and revolutions.

I’ve also watched in horror as a hashtag “blows up” while the Internet—bored, and starving for something, anything to frenzy-feed on—zeroes in on a statement taken out of context, an offhand comment that unknowingly became co-opted as a sound-bite for someone else’s rant or cause célèbre.

I love the Internet and its nearly perfect ability to act as a vehicle for a truly democratic and representative communication tool… and Twitter has come to embody the very best and worst of that communication.

At least part of the problem has to do with the simple fact that 140 characters, the limit on the length of a Tweet, is just enough to present a statement, and not nearly enough to provide context, support, or any significant development of that idea.

Taking things out of context isn’t a problem unique to Twitter, of course, but the 140-character limit of the medium practically demands it.

A quick, easy example: It’s not uncommon to hear a teacher at my school say of their students, “I love my students.” I have said, in chiding my students for a momentary lack of attention, said something along the lines of, “I love you guys, and I want good things for you. Let’s get back to work, shall we?” Is it a surprise to hear that teachers love their students? Of course not. Is that something that could be taken out of context on Twitter?

Ummmmm, yeah. Of course it can.

Another example of risk, as quoted by Audrey Watters in her op-ed piece Is Twitter the Best Online Source of Professional Development?:

Steven Salaita, for example, had his tenure-track position at the University of Illinois Urbana Champaign rescinded after the university disproved of his tweets in support of Palestinians.

As Bonnie Stewart argues, “The threat of being summarily acted upon by the academy as a consequence of tweets – always present, frankly, particularly for untenured and more vulnerable members of the academic community – now hangs visibly over all heads…even while the medium is still scorned as scholarship by many.” While there are efforts to encourage educators and students to participate in the public sphere, via tools like Twitter, it’s clear that there are also risks in doing so, particularly if what’s being said fails to conform to certain “community standards” or certain notions of “civility.”

I have actually used Twitter on occasion, including several sessions acting as a “Twitter correspondent,” and have had a couple of my tweets removed by the person who was responsible for making sure those messages were in keeping with the guidelines of the organization. It was an interesting experience, to see my work edited in such a fashion, and it was a great reminder (if one was needed) that others read tweets and interpret them as they will. (For the record, I didn’t find anything offensive in those tweets, but it wasn’t my account I was tweeting under, so I accept the edits.)

But my takeaway from that experience and the experiences of others (see How One Stupid Tweet Ruined Justine Sacco’s Life, and Too Many People Have Peed in the Pool for two examples), is simply to not use Twitter. I have a number of other communications tools that I am free to use with friends, family, and co-workers, and I have no need to recruit followers, nor to deliver pithy, entertaining, or even useful comments to the universe.

Some educators may find that tweeting is a rewarding experience, and I absolutely do enjoy reading the tweets of some of my colleagues. For myself, however, I find the personal / professional risk of tweeting to be unacceptably high.

One last warning, courtesy of Catherine Garcia, published on August 25, 2015 at TheWeek.com:

Former MLB pitcher and current ESPN baseball analyst Curt Schilling was reprimanded by the network after posting a questionable meme on Twitter.

On Tuesday morning, he tweeted a meme featuring an image of Adolf Hitler with the words: “It’s said only 5-10% of Muslims are extremists. In 1940, only 7% of Germans were Nazis. How’d that go?” Schilling added his own commentary, the Los Angeles Times reports, writing, “The math is staggering when you get to the true #s.” He deleted the tweet 10 minutes later.

Not long after, ESPN announced he would no longer be covering the Little League World Series. “Curt’s tweet was completely unacceptable, and in no way represents our company’s perspective,” the network said. “We made that point very strongly to Curt and have removed him from his current Little League assignment pending further consideration.” Schilling returned to Twitter to take responsibility, writing, “I understand and accept my suspension. 100% my fault. Bad choices have bad consequences and this was a bad decision in every way on my part.” The lesson here is simple: Don’t use Twitter.

Do you use Twitter? Do you use it in your capacity as an educator? In which direction does the Risk/Reward balance tip for you?

Inspiring Students

INSPIRING STUDENTS

2015-03-07

by Richard White

Earlier in my teaching career I worked at a high school that had a depressingly low rate of its graduates going on to college. It’s the desire of every teacher to encourage students to continue their learning, and while that doesn’t necessarily mean college for everyone, for most people it should. Encouraging my students to apply themselves and to strive for something big was a noble challenge, and an exhausting one.

At my current school, I have the benefit of getting to work with a different population, and one that is almost always appreciative of the advantages that they’ve been afforded in life. In addition to taking full advantage of the opportunities they’ve been given, some of them push even farther, and in so doing, inspire me to be better myself.

apcs_project

A couple of days ago, I received this email out of the blue from a student who’d graduated last year:

Hi Mr. White!

In my CS106A lecture right now, and we’re learning about passwords. Reminded me of that one time you spent physics class telling us to back up our hard drives and how to make passwords :) hope everything’s going well at Poly!

The next thing I did, of course, was search for the website for Stanford’s CS106A course to see how what they were doing compared to what I do in my own CS courses, and three hours later, I’ve got some new ideas to consider for how I run things next year.

It wasn’t this student’s intention to provide me with an opportunity to reflect on what I’m doing—she’d just wanted to say hi, and I appreciated that and responded in kind. But it was the perfect excuse for me to see what my former students are moving on to, and to reflect on how I might better prepare them for what awaits after they leave my care.

Another example: a current student has been working with me for a couple of years now, and after enrolling in his second computer science course in as many years, he approached me about the possibility of helping him with an idea he had for a Python program that would:

  1. allow him to enter the title of a song
  2. search YouTube for a recording of that song
  3. automatically download that song to his computer

There is certainly the possibility of making something like this happen, but it’s a bit beyond his (and my) skill set at this point. I couldn’t help him with this particular project… but I could prepare a couple of smaller programs that might provide some first steps along that path. I spent an hour or so setting up a Python program that would automatically send an email to someone from his Gmail account, and another one that checks a NOAA webpage to identify the current temperature, and then reports that temperature back to whomever is running the program.

These are relatively small programs, but for a new programmer, they’re the first step in writing code that interacts with the world outside his/her own machine. And thanks to this student’s request, I’m considering including a small project on this very thing as part of my own Introductory Computer Science course.

Teaching at my current school is a refreshing change from the days when I had to lead my students through classes that they had difficulty appreciating. Now, it’s often my own students, current and former, leading me in my ongoing goal of becoming a better teacher.

I’m lucky to be able to work with these young men and women.

The Best and the Worst of Online Learning

THE BEST AND THE WORST OF ONLINE LEARNING

by Richard White

2014-12-25

mooc_reviews

A few months ago I signed up to take my fourth Massive Open Online Course (MOOC). We’ve discussed MOOCs here before, but it’s been awhile since I’d taken one, so perhaps it’s time for an update.

My track record with regard to these MOOCs is better than that of most people. The first one I took, a Python-based course on Building a Search Engine offered by Udacity, was far and away the best one I took. The whole MOOC craze hadn’t really started yet, and so it was clear that the instructors wanted to get this right, and that fact showed in the time and care they took in developing both the curriculum and the materials used to support the course. I followed the course, completed assignments as required, and earned a “certificate of completion” at the end of it all. Based on my experiences with that single course, I became a true believer in the concept of MOOCs.

I signed up for a couple of other classes over the course of the next couple of years, but didn’t complete either one. Udacity’s follow-up CS212 course, Programming Principles, taught by Peter Norvig, was poorly organized and poorly delivered, a disappointment all the more striking on the heels of the first course. Based on comments left on the course Discussion Board, students abandoned the course in droves. (Here’s an online review from a student as well.) I left my own comments on the Udacity Discussion Board:

…One of the important tenets of education is the idea of giving as student a problem that is just beyond their current level of understanding, along with the tools he or she needs to make that next step. In CS212, in the first unit, just about every quiz solution reveals a strategy or technique that had never been broached in the discussion to that point.

Yes, I understand that “the real world” requires one to do independent research as required. This is not “the real world”–this is an educational course that is intended to guide me in discovering the tools that I can use to solve problems. CS212, in that regard, has been a bit of a disappointment.

The third course I took was again offered by Udacity, this time a Java-based Intro to Programming course that I quite liked. It had the benefit of being taught by the author of the textbook I use for the AP Computer Science course I teach, and it was entertaining for me to hear his audio- and video-recorded development of topics that I would be teaching myself. I didn’t complete this course because I got busy prepping for school, and that seems to be a common malady when it comes to MOOCs. Without the structure offered by a regularly-timed class, there is an enormous attrition rate.

Just a few days ago, I completed the second of the four MOOCs I’ve taken, this one an Introduction to Linux offered by edX. I finished the course–a PDF certifying that fact is being readied as we speak!–but I can’t say it was a pleasant experience.

Here’s the thing. Learning is hard, and teaching is even harder. You’ve got to help students develop a coherent picture of the content and process that you’re presenting, typically with explanatory comments to help them understand why something is the way it is.

Here’s the type of video I got in this most recent course.

This is not teaching.

I survived the course only because a) I already knew most of the material in it, and b) the “final exam” consisted of 30 Multiple Choice questions, open notes and open coursework, with two tries allowed for each question and a pass-fail cutoff at 70%.

MOOCs aren’t going to go away. With a lot of planning and forethought, it’s possible to do them well. It’s also extraordinarily easy to mess this up, and it’s going to take some time for things to settle out. There are lots of challenges to be solved. How to reliably deliver good content? How to accurately gauge students’ progress? How to certify completion/mastery?

We’e seen some interesting forays into this new area of learning, and we’ve seen the ensuing land-grab by various corporations and higher-ed institutions, and the backlash that resulted from trying too much, too soon. We’ll see within a few years what we’ve decided to make of all this.

In the meantime, feel free to try out a MOOC and see how it feels. If at all possible, see if you can determine in advance how well a given course works. Coursetalk.com may be one place to start.

Good luck… and I’ll see you online.

Whither Data?: Dude, where’d my content go?

Whither Data?: Dude, where’d my content go?

by Richard White

2014-09-20

Part II in our series.

In a previous post, Whither Media?, we explored the ongoing transition away from physical media, and what implications this transition might have. The related question is Whither Data?: What happens when your content—your written documents, photos, email, music, etc.—are all stored on somebody else’s computer?

The Cloud is a term that has a number of definitions, but typically it refers to a collection of servers run by a company that (usually) offers a user access via Internet to that data and those services. In addition to offering Internet access, a cloud-based service typically implies multiple servers hosting redundant copies of the data, providing faster access to the user and backups of a user’s data.

If you use Google’s Gmail, your email is stored on their servers, “in the cloud.” If you use Google Docs, your documents are stored on servers, “in the cloud.” Microsoft’s Office 365 stores your Word, Excel, and PowerPoint documents “in the cloud.” And although you may not think of it this way, many social networking sites such as Facebook also provide content and services “in the cloud” so that your conversations, photos, status announcement, comments, and Likes are store where you and others can view them.

There are a number of powerful advantages to using cloud-based services, and most of these are self-evident, especially to teachers. At my school, which provides Google Apps for Education (GAFE) to teachers and students, we’ve been able to offload our email services to Gmail and provide Google Docs and Calendars to the entire community, allowing for teaching strategies and communication workflows that simply weren’t possible before. Content Management Systems (CMS) and their educational offspring Learning Management Systems (LMS) provide a structure—usually a proprietary one—in which a teachers information can be delivered and a students interactions with that information can be tracked.

I love the fact that the ability to share data from user to user and machine to machine has become easier. Without cloud services, teachers would be forced to a) try manage an endless and non-linear flow of emailed attachments (something some of us still do, I’m sorry to say), or b) implement and manage our own servers to which students can upload documents, and from which they can download them. (Actually, I do do this, but it’s in the context of a computer science course in which those processes are part of the curriculum). Cloud services allow for shared files, shared folders, and drag-and-drop functionality that “just works” (most of the time).

There are two caveats here, however. The first concern is security. Unless students are encrypting their documents before uploading them, there’s the possibility that the information in those documents—perhaps confidential, private information—may be visible to others, either in transit or on those servers. The reality for most teachers, I think, is that the documents that students are sharing with us—book reports, essays, lab reports, homework assignments—don’t require a high degree of security, and so maybe this is just fine. If you were having students email Word documents to you before, having them work on a GoogleDoc on Google’s servers is at least as secure, and almost certainly more unless they’ve elected to make the document’s contents available publicly.

I am not a doctor or lawyer and am not aware of the specific legal requirements concerning the secure storage of patient or client information, but I would investigate that carefully before using cloud services for these purposes.

Perhaps a more significant concern for teachers and students, however, is retaining access to cloud-based content over the long term. Low-priority content like quizzes or in-class essays may not be of much concern to students, but more significant essays, research papers, or portfolio work has a higher value, and may even be submitted to colleges as part of an application. Ideally, a student would be able to retain access to their work—and it is their work, isn’t it?!—for some indeterminate time into the future. Which cloud-based services allow for that?

The notorious offenders here are the providers of online books—where online notes and marginalia disappear when your one-year access license expires—and the various Content Management and Learning Management Systems, with password-protected access that may not extend beyond the current year. Students who create or store documents in these systems are at high risk of losing access to them when the end of the school year comes around, or the next school year starts begins (depending, of course, on the administration of the system).

The same may happen with Google Apps For Education, although it is much easier to export this data onto a student’s own computer or data storage device, assuming he or she has access to something more than a Chromebook. Here, a personal Google account may come in handy, although questions about privacy of these documents may be relevant.

exporting_a_google_doc

I don’t think we’ve yet reached the point where lost access to data is a broad concern, although some are wrestling with this issue already (as mentioned previously here. 34:20 in show). As we ask that are students create more and more of their work in a digital form, however, it’s fair that we keep these questions in mind: ‘Should students have access to the data that they’re submitting to me?’ and ‘How do I go about facilitating that access?’

Daniel’s Search Hack

DANIEL’S SEARCH HACK

by Richard White

2014-05-24

ap_comp_sci

On one of the last days of the AP Computer Science class, I met with a few students who had been participating in the High School Capture the Flag hacking contest. A high school in New Jersey had created a competition that would allow teams of high school students using digital tools to solve various types of puzzles.

One of the problems involved a text file with just two lines in it. The first line explaining that students would need to search the file for a series of English words in sequence, although those words wouldn’t be separated by spaces. The second line consisted of over 10 million letters, mostly scrambled, but with words occasionally found within them.

Here are 200 letters from that file:

nhisseokenphoncecrgoeemmoedkihrhobufiiripsthituhelttiytftihweaihurmadarwwesrfeehstetpiaiiendyeogeallrrrescihslhyorsdccalloaaoeyrotlnnstuovdhreshapmmrennaaehtprsedtlsciaemtggsriedencsneihassskusosekhci

You can see the word “hiss” in there, as well as “rips”, “fee”, “call”, “has”, as well as a number of 1- and 2-letter words, but clearly nothing identifiable as a sequential series of words.

So how do you go about looking those needles in that haystack?

I had some ideas, and I’d been working on the problem for a day or two. I wrote a Python program to read all 10 million characters into a string so that I could search through it. I Googled and found a couple of lists of English words, arranged in order of popularity, and inserted those into my program as a list of words.

But now what? How do you start trying to find a sequence of words in a line of ten million letters?

My first algorithm looked liked this:

  1. Get a word (call if word1) from the word list, and another word (word2) from the word list.
  2. Look in the text for an occurrence of the first word.
  3. If you find that word, look to see if the second word is near it. It it is print it out. If not…
  4. Keep looking for additional occurrences of the first word and the second word, until you can’t find anymore.
  5. Get a different word2 from the list and check that against word1.
  6. Repeat this until you’ve tried ever word in the list as word2.
  7. Set word1 to the next word in the list and repeat the whole process.

It didn’t work. It was a first attempt at trying to work through the file, and this particular strategy was much too slow—my search was going nowhere fast.

Time to alter the strategy.

My second try concentrated on reducing the number of text interactions that had to take place. This time, I would:

  1. Take the first word in the word list identify all the locations (indexes) where that word existed in the string.
  2. Do this again with every word in the word list until I had a “dictionary” of word locations.
  3. Now start at the first word, and look at its first location. Go through the other words and their locations, and if a second word was found withing 10 characters of this one…
  4. Look for a third word with a location with 10 characters of this one…
  5. … and then a fourth word. If I could find four words all within 30 characters or so, perhaps this would identify the flag phrase.

Here’s what the results look like for that strategy:

It didn’t work. I mean, the program worked fine, producing a seemingly endless string of lines that matched the specifications I had, but none of the lines produced were what I was looking for. Here’s the partial output from that second algorithm.

alludcgytsooiahitaonoayhlfcdseheieytreee
alludcgytsooiahitaonoayhlfcdseheieytreee
alludcgytsooiahitaonoayhlfcdseheieytreee
alloswvgtwousmipohivteceyihrugitdrttsinu
allesettupslasweoovnsetlbiaerietmntadnea
allesettupslasweoovnsetlbiaerietmntadnea
allesettupslasweoovnsetlbiaerietmntadnea
allechslaashtwnonhhsirewteoaeadmoiitlrhi
alloiarlfeyedacusoemtniohneegsaailaennso
alloiarlfeyedacusoemtniohneegsaailaennso
alloiarlfeyedacusoemtniohneegsaailaennso
allswhybrnastsoetedotwilnrmollhtieeterol
allpeinnucctdanyedrtsittadhhnldvsiniedln
alladhlasgdeaeihownaotoroeemhaueailoenwh
allihyhcinnchpbsoileowidsupredhnpywoweyh
allihyhcinnchpbsoileowidsupredhnpywoweyh
allmhmsfoodieutreethktevkevfaieehvtlhaii
allvcniaionoeuwesthiontnebedneehgecetlts
allvcniaionoeuwesthiontnebedneehgecetlts
allacohohhssoraaehylesooyfeeithseiioatrm
alllaseeatholnsttochtiwrlsridtwodrefvneo
alleeoninshrhugdnewizdeydtepnrartsossrtl

I still was getting “words” in each of those lines that didn’t correspond to the flag I was searching for. This was starting to get frustrating.

I went into class the next day and explained to the students my frustrations, and they were happy to brainstorm different strategies. At one point, Daniel said, “Why don’t you just look through each line in the file and count the number of words in it? Maybe the line with the most words will be the one we’re looking for.”

“That’s a good idea, Daniel, but the file isn’t split up into lines. It’s just one long line of characters.”

He thought about it for a minute, and his partner Ezra said, “Well, let’s just split it up into lines. 140 character lines. That’s good enough for Twitter.”

So that’s what we did. The students have been studying Java for this past year and I was coding in Python, so they watched while I coded their strategy:

    for line in lines:
    num_of_words = 0
        for word in searchTerms:            
            if line.find(word) != -1:          
                num_of_words += 1
                if num_of_words > 25:
                    print num_of_words, line

Because it was a relatively simple strategy, the two decided that they could afford to search for any words contained in 10,000-word dictionary. We watched as the results appeared on the screen:

Last login: Sat May 24 18:03:42 on ttys002
MotteRouge:~ rwhite$ /var/folders/6x/vklj_pls5215szrp_k2qcjcc0000gn/T/Cleanup\ At\ Startup/find3-422672661.132.py.command ; exit;
File has been split into lines! Proceeding…

26 netenivgdyblduenehttihaaoshasnoadhigdateilnoteanabinmstaruceoarasuleedpnhtgeoendtgedeeincodolropthei
26 deeeeepraosderwfsrerepimnsinaosutttnoeytvrvtheterthistollagtitnhsminewitcecnlrsbgeoeddiorwadanartell
27 chaoomelohdanamtgswsbtroddtapmcfhlewasalnewasisscelapostnecstotvstviiiederectunoauwjleeddicbsigesnem
27 ailmavbfngdfawdigcrseentatoueiefrdrnorfkersrutccamemdireaeiedsleoauieiaitmlsitemhiapropenhbutworfson
27 tnatrsirvsprosaeseebatoniwrtaptranuinetdsyraheroenattphweelilnhopedelrudolbiaimoioiaahlttonesoucoduy
26 thahksvrtetentnaanyosmyclekrmrnotestadrtslonuisnproncedpesaehietidethereheionmcbalasaeriantrsrheteeh
26 odicelerussltltmerehsoaeebaotruettanarfdereunecgtsnsnatllasteakitnngodrsuseerthdfaisirnswaudcsvwhvie
27 akyoeaaptebheaeasetrrsdairnslegstensnhhtirepysuxxthseelesnetfdaniknsethaiarsoslutsperaegotedibnnlids
27 hidsrdaedoiltdetoeiepdscencairdstheeovrncwaaihstnthtnebemochthestyaahiseperateanhistseaoneeyntareade
26 edlotetwlettdtstfdnseovnrpamatelfroltsmahliassseaueeeamihnhgavepaadatrglettanitoleeenlredramdhoyaddt
30 latecwhoodehderowtaesitfeflantenvweosrehonsethlaerateeeersiosrlesuaidpeutdineacetzrthrchbhrideeafsat
26 tvanodeaosomidhonatnusidispithscvhsnhsoilesacciraeenycielaehoallooldamwrneirwcfamotntrdataoeenogleeb
33 ntevnaaureakltyashtbosutheselettersrepresenttheclothmarkerthatunlocksrewardsehegcceremuahwtmknnflswa
29 bandosytrctanoyearenonajrnpasrlgaohisnhunetnsielistdoecdpeehenaasshecisiojersydataelpsheeulhesvfonli
28 nargelrhendedtoidlteauuvtihsursaioptehetclbnigeauhoneystolheatbsantrwmsctipsslagedsehieahsadoacscihn

And there it is, on the line with 33 matches, just a few moments after starting the program running:

these letters represent the cloth marker that unlocks rewards

We submitted the flag to the contest and saw out score total immediately jump up 400 points—it was our single biggest success of the competition to that point.

I like this story because it reminds me of a few things that we sometimes forget. Working on digital problems like this is not always about coding— sometimes it’s about strategies. Also, there are trade-offs in strategies that require considering constraints: how much memory, power, time, and data do you have? How do your solution results vary based on the trade-offs you make?

Computer Science teachers talk about these things, but I’m always pleased to see a situation where the students get to actually experience that exploratory process themselves.

Thanks to Daniel, Ezra, Adam, and Stephanie for being willing to play with this problem on the last day of school!

Computer Science in Schools

Computer Science in Schools

by Richard White

2013-12-26

Happy Holidays everybody!

The holidays are no time to get any rest. Oh, no, there’s too much going on–parties, holiday shopping, out-of-town visitors–to actually get any down time. No, to actually get a chance to relax, you have to resort to more drastic measures… like getting sick.

That’s my genius plan, and it’s working just great.

While I’m sitting around waiting for my body’s defense mechanisms to do their thing, I’ll just include a quick year-end pointer here to one of Audrey Watters’s year-end Trend posts, this one on Computer Science in schools:

Despite the proliferation of these learn-to-code efforts, computer science is still not taught in the vast majority of K–12 schools, making home, college, after-school programs, and/or libraries places where students are more likely to be first exposed to the field.

There are many barriers to expanding CS education, least of which is that the curriculum is already pretty damn full. If we add more computer science, do we cut something else out? Or is CS simply another elective? To address this particular issue, the state of Washington did pass a bill this year that makes CS classes count as a math or science requirement towards high school graduation. Should computer science – specifically computer science – be required to graduate? In a Google Hangout in February, President Obama said that that “made sense.” In the UK, computing became part of the national curriculum.

She has a bit more to say on the subject, but her thoughts echo many of my own. Does everyone really need to “Learn to Code”? How important is Computer Science in the midst of an already bulging academic curriculum? How can educators and the tech industry best reach out inclusively to students on behalf of an industry that is not only famously non-inclusive, but downright hostile to some demographics?

It’s a problem that merits discussion at all levels, and there are certainly institutional responses that might be pursued. As I expand my role as a computer science educator I may even become involved in some of those—that’s certainly my intention.

In the meantime, I consider myself on the ground doing the front-line work without which nothing else matters. “For this assignment, students, we’re going to…”

“Oh, cool…!”

If you’re not doing something cool with your computer science, well… what’s the point, really? ;)

Merry Christmas and Happy Holidays, everybody. See you in the New Year!