Category Archives: AP Computer Science

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.

Teaching CS: Am I doing it right?

Teaching CS: Am I doing it right?
=================================

by Richard White

2016-11-10

I’ve been teaching Computer Science in one way or another for a decent part of my teaching career, from courses using BASIC and Pascal on standalone PCs (pre-Internet!) back in the 80s to courses using Python and Java currently. I’d like to think I mostly know what I’m doing by this point.

It’s interesting to note, however, that there is a wide variation on how teachers work with students in a computer science classroom. From the AP Computer Science teaching community, I’ve heard of teachers who:

* have their students use Linux workstations exclusively
* have their students learn Java exclusively through graphics programming (Processing language)
* have their student use web-based Java compilers/interpreters
* have their students learn how to interact with a server
* have their students turn in all assignments on paper only
* have their students retrieve lessons and submit assignments using GitHub
* teach Java by having their student write mobile apps

It’s a stunning variety of strategies given that we’re all teaching the exact same course with the exact same curriculum.

And maybe that’s a strength of computer science, that there are lots of ways to make it happen. Whether you use Linux or OS X or Windows, whether you program using a terminal or an IDE, whether your programs interfaces are text-based or graphical… we’re all teaching computer science.

If there’s a downside to this variety, it’s that we may be tempted to feel that some of the other strategies–old ones that we haven’t had time to consider, or new ones that have just been recommended to us–might be better (more interesting? more effective? more appealing to students?) than what we’re currently doing. And so we feel compelled to give these new strategies some consideration.

In the last few years there has been an explosion of interest in Coding (which is not quite the same thing as Computer Science, but we’ll take what we can get, eh?). Hadi Partovi’s Hour of Code, MIT’s block-based Scratch language, the Raspberry Pi, the Arduino, the College Board’s new AP Computer Science Principles curriculum… and these are just the most popular of the recent technology and CS-based innovations that might merit some consideration by me, with an eye toward possibly incorporating some of them into my teaching toolbox.

How much should I stay the course and stick with what I think works best? How much of my limited professional time should I invest in consider these other possibilities?

More than teachers in any other subject area, we teachers of Computer Science need to wrestle with these questions. It’s a de facto part of our job description.

What is your specialty in teaching CS/technology? What topics do you add to your courses, because those topics work, or they’re part of your pre-existing skill set? Do you feel pressure to always be looking at The Next Big Thing?

For related reading: http://blog.acthompson.net/2016/11/too-many-cs-teaching-resources.html

Boys Like to Break Things

Boys Like to Break Things.txt

by Richard White

2014-09-10

It’s no secret that Technology Education has something of a gender problem. For reasons that are still unknown (at least to me), I have far fewer female students in my Computer Science courses than in my Physics classes, where the ratio is close to 50-50. I encourage young women to join my classes, and even had the honor of advising an all-girl group of “Technovators” in an app-design competition the year before.

It’s a curious thing, and although I’d like to find a way to improve the girl:boy ratio, it’s not entirely clear what I should do to do so.

An interesting thing happened in the AP Computer Science class the other day however, and it broke down along gender lines. We’d taken a few moments earlier in the period to examine an old PC running Linux that I’d placed at the front of the room. I’d taken one side of the tower off, and we were looking at the motherboard, graphics card, disk drive, CPU, etc.

And a bit later in the class we were going over shell commands that students might find useful, and after introducing the “remove” command (rm), I mentioned the dangers of inadvertently typing sudo rm -rf /, a command which will recursively remove every file on the computer… usually not something that one intends to do.

it’s an interesting concept, and the thrill of a dangerous command like that holds some inherent appeal, perhaps, to geeks. And then one of the boys raised his hand and asked, “How long will it take before the rm command eventually removes some critical file that is necessary to the ongoing operation of the computer?”

It was an interesting question and one that I hadn’t given much thought to up to this point. The rm command is working on the hard drive, while the operating system mostly resides in RAM, but there are swap operations in which the OS interacts with the hard drive, so… this was a great thing to ponder. At what point does the snake eating its own tail become unable to continue?

You know where this is going. “That’s a great question, Cyril. Let’s find out.” So I had one of the students type the requisite command on the computer that, moments ago, we’d used to demonstrate hardware. They hit the Enter key and took great delight in the list of files scrolling by on the screen, a live-action view of what was being deleted as the rm command slowly destroyed the OS.

This singular opportunity was of such interest that the students crowded around the machine to watch the spectacle, and one young man recorded the event on his phone…

Here’s the other part that you can almost certainly guess. Of the four young women in the class, not a single one came up to the front to watch the event up close. Were they intimidated by the gathered crowd? Was the destruction just less interesting to them? Were they thinking about heading off to their next class? Are boys just more interested than girls in testing things, even (especially!) to the point of breaking them?

I don’t have the answer, but I think about these things. We all need to be thinking about these things, and encouraging women who express interest to explore the idea of learning more technology.

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!

Online Presentation Strategies

ONLINE PRESENTATION STRATEGIES

by Richard White

2013-11-27

I blame it on the fact that I’m teaching a new course.

As I’m teaching AP Computer Science, and developing curriculum, assignments, and lessons for that class, and trying to figure out what works—and what doesn’t—there are lots of mid-course adjustments that I make. Not every assignment needs to be perfect, perhaps, but if I don’t get done addressing all the concerns in that one lesson, it’s hard to have very high expectations for the work that students will do that evening.

And in an AP course, time needs to be used wisely. I can’t afford to be expanding units when there’s a certain amount of material that must be covered by the end of the year.

Fortunately I’ve been able to leverage YouTube and GoToMeeting videoconferencing software to take up some of the slack while I get my act together. A 3-minute follow-up to a lesson, emailed to students, can help to proactively clear up a lot of confusion. Likewise, being available for online office hours, during which students can share their screens with me and we can debug their programs… that’s invaluable.

And although I’ve usually worked on the computer in the past, with a voiceover that describes what I’m doing, it’s often useful to “do a Khan” (as in Sal Khan, of Khan Academy), and just write some stuff out. I don’t have any evidence to back me up here, but my gut says that there’s an enormous cognitive benefit to developing things progressively, and by hand.

Here’s an example of a combination of drawing and computer analysis, done not for the AP Comp Sci class but in preparation for an Hour of Code unit that I’ll be using with some students. See what you think:

Do you see any advantage to demonstrating things in long form, as opposed to doing voiceovers with slides or computer displays?

More on the Hour of Code in a future post…

Differentiated Instruction in AP Computer Science

DIFFERENTIATED INSTRUCTION in AP COMPUTER SCIENCE

by Richard White

2011-11-15

We’ve just completed the first quarter of the school year, and I’m loving (and for the moment surviving) the opportunity to teach a new course: AP Computer Science.

I actually began my teaching career in 1986 as the instructor of a computer programming class, first using BASIC, and then Pascal, on IBM XTs–the original beige PC. This was well before you crazy kids had access to the InterWebs, but we loved our computing machines just the same.

So it’s funny, and fun, to be teaching Computer Science again, and it’s exciting to be participating in that daily experiment we call “teaching,” in which the instructor hypothesizes about what might be an effective tool or strategy for working with a class, tries it out, and then goes home to clean up the mess of those experiments that–wonderfully or tragically–failed.

I’m finding out that my students this year have a wider range of abilities than I’m used to seeing in the AP Physics class I teach. The possible reasons for that wide range don’t really matter; I’m there to teach the students who are in the class, meet them all wherever they are, and see what I can do to help guide them in learning the subject.

How do you actually do that, though? How, practically, do I proved instruction and lessons for a classroom full of students, some of whom are going home and programming their own Blackjack programs just for fun, while others are having profound difficulties applying concepts that they appeared to have understood well just the day before?

The act of providing these varying levels of support in a single class has earned the buzzphrase differentiated instruction, and here’s what I’ve developed for a typical lesson:

  1. a whiteboard-based overview
  2. whiteboard based pseudocode
  3. freestyle coding for advanced students
  4. template-based support for intermediate students
  5. solution-based support for students who need more support

Wanna see it in action? Here’s a 7-minute documentary-style rundown, complete with footage of the kids hard at work.