Tuesday, June 4, 2019

Cheating with Project Euler

I've been asked how I use Project Euler for graded assignments, given that it's quite easy to find the solutions to those problems online. (That I would happily dispense with the insidious practice of grading is another matter.)

The answer is that I don't grade students on actually solving a problem, I grade them on how they go trying to solve it.

Some background: once upon a time, during my first year teaching, a student...let's call her 'M'...asked for help. I pulled up a chair and sat down, and M said, "Ok, I'm going to explain what's going on, but I don't want you to say anything. Then I'm going to ask you a question and I want you to just answer that question. Ok?"  I agreed, and halfway through her explanation she got excited and said, "Oh, go away! Go away! I got it!"

I always loved that story, because I wanted all of my students to have that attitude, but it took many years for me to notice the pattern that is the real lesson of that story: students would ask me for help, and while explaining the problem they would spontaneously realize what the problem was. It seemed that these novice programmers had everything they needed in their heads, but they didn't have experience organizing it and moving methodically through it. In finding words to explain it they would see what was going on.

And I think there was another effect: we are rewarded year after year through formal schooling, for being able to quickly whip off correct answers to questions. We are taught to believe that it is a sign of intellectual weakness if we have to spend time pondering something. So we blindly rush forward.

But when we have to wrap words around thinking it forces us to slow down and think about what we are doing.

So a few years ago I tried an experiment: instead of asking students to submit their final work, I asked them to keep 'journals' of their progress (in Jupyter notebooks, which I will talk about in another post) in solving a puzzle, and explained that the grade would be based entirely on how thoroughly and clearly they documented their attempts.  Instead of just changing their code, they first copied and paste it, then change the copy, and explain what their thinking was.

The first time I tried this they had only been coding for two weeks. I assigned everybody the first Project Euler challenge, "Multiples of 3 and 5."  The results amazed me.  I haven't done a controlled study, so this is my subjective impression, but the success rate was much higher than I've come to expect from novice coders.

One girl's journal really stood out. She clearly had been telling herself (after only two weeks) that she lost and confused and behind (largely, I expect, because the art of memorization she had been trained in for the previous 10 years was not applicable here), and her journal entries conveyed an overall message of "I have no idea what I'm doing but the teacher said to write about my struggles and I can at least do that."

But over and over again these entries started with her writing, almost despondently, about how it wasn't working, but ended with a glimmer of an idea.  Slowly, step-by-step, she figured things out, and fixed bugs, and a couple dozen entries later she solved the challenge.

For the rest of the term, each week each student was asked to submit a journal of their attempts to solve a Project Euler problem. They chose any problem that interested them, with the understanding that their grade would be based entirely on the quality of the journal, and not on whether or not they solved the problem. The grading rubric evolved over the term, but the basic expectations were:

  • The bigger the change in the code, the more important that they explain the thinking behind it.
  • Presentation, including grammar and spelling, mattered. My  logic was that the more thought they were required to put into the writing, the harder they would have to think about it.
  • It was ok to ask others for help, and even use the Internet, but they must thoroughly document any help received, and that while they wouldn't be penalized for doing so they also wouldn't get credit for it. 
  • They got extra points for creativity, illustrations, etc. This was just to try to get them to engage more with the material.
One implication of the rules was that if they chose a problem that they solved too easily and/or quickly, they wouldn't get a very good grade, because there wouldn't be enough to the story of how they solved it.

Not everybody got it right away. Occasionally a student would solve a problem in one or two tries and submit that, but a C or even D quickly cured that. And there were a couple of incidents, over several terms of teaching this particular class, in which students quite obviously Googled the solution. But in their notebooks this appeared as huge conceptual leaps with no explanation (or understanding), and their grades suffered accordingly. That took care of that.

My rationale was that they could cheat on these notebooks, if they wanted to spend the time composing "fake" journal entries, but:
  1. If they could fake convincing entries they would actually be learning exactly what I wanted them to be learning.
  2. They would quickly discover that it's more efficient to just write real entries.

Wednesday, July 6, 2016



Today at the Addison we examined prints of Josef Albers. Students were thinking deeply about what colors they saw in each of these prints. How powerful to know that Albers was thinking the same things as he created these pieces. After our visit, students designed their own Albers-inspired rectangles that changed with size, location, and color. Seeing them create code to match their own art work was fantastic!




Sol LeWitt's wall drawing brought together many of the concepts we have studied. Through previously written rules, LeWitt asked participants to randomly select a segment or arc for each square foot section. The class looked at all the possible options for a random selection and then looked for streaks. Returning to what they have experienced already with coding and combinations was gratifying to see in such beautiful art work.

Saturday, July 2, 2016

Wall Drawings


Inspired by Sol Lewitt's Wall Drawing #797, the students investigated what happens when a simple rule...drawing a line that stays, or attempts to stay...equidistant from a non-straight line...is repeated many times.

We did the first version together in class, after first predicting what would happen.  The predictions were mostly that the bottom line would look like the top line, and when it turned out that it wasn't, students hypothesized that it was due to human error.  We broke up into groups and investigated that theory, and eventually...through many different and creative arguments...the students concluded that it wasn't just human error; that the inevitable result is that the lines will tend to smooth out over time.

Then we went outside with some sidewalk chalk and asked strangers to help us do the drawings again, but by following rules the students had written down, without verbal instructions.

A question that most of the students were still struggling with at the end was: if duplicating a wavy line eventually leads to a smoother line, if you erased all but the smooth line and worked backward, would you get back to the wavy line?

(If you think you know the answer, and why, feel free to post here!)





Thursday, June 30, 2016

Random Explorations


This morning we spent time flipping coins and looking for "streaks", and predicting/discussing how long we expect them to be.  Then when transitioned to coding we simulated flipping LOTS of coins...millions and millions of them.

We got to see how the actual physical process (flipping real coins), a computer program that generates pseudo-random numbers, and some math (exponents) are all representations of the same thing.


Wednesday, June 29, 2016

Peabody Essex Museum - Salem, MA




A Public Experiment


Tuesday morning we had some introductions and activities to get to know each other, then we launched into our first "Our of Code" using the python programming language.  Elaine and I may be scrambling to create more coding content before the end of this course because the students raced through the first lesson, writing loops and learning about variables and increments.  A favorite activity was seeing how big numbers need to get before it starts affecting the computer (numbers with more digits than can fit on the screen seemed to be doing the trick).

In the afternoon, after some Summer Session orientation, we returned to class and broke out the KEVA planks.  The goal of these activities was to both practice writing clear & unambiguous instructions, and to gain an appreciation for how hard it can be to so.  As the students discovered, there's a good reason LEGO sets have pictorial directions instead of written directions.

We went through a couple iterations of designing structures and then trying to write instructions that other people could follow to re-create the same structure.  Then it was dinner time and off to Paresky Commons to ask other Summer Session students to try to follow our instructions.  Each team of two students tested out the instructions from a different team, taking notes and photos.  The exit polls seemed to show that this was a lot tougher than was expected.  "Wow...people are bad at following instructions!" was one conclusion.

In class on Wednesday we'll share findings from this experiment.





Monday, June 27, 2016

Day 1: Arrival

Everybody is here! Elaine and I spent most of the day at Adams Hall, greeting students. We had arrivals all through the day, with very few hiccups (some problems with keys to dorm rooms). And it was hot, hot hot...fortunately the summer school office has a huge supply of fans. I wonder how many of them have been left by students from previous years? Elaine and I also finally got keys to our own classroom...and discovered that all the desks are the one-piece units that combine chair and desk, which would make it tough to do some of the projects we'll be doing that require large work surfaces. Plus the desks have sloped tops, which won't work with Keva planks. And there's no wall space to work with. Uh-oh. Fortunately, Mike Barker at the Library came through for us and for the next two weeks we'll be in the Makerspace, which is really the best classroom at Phillips Academy. Tomorrow morning at 9:00 "Seeing in Patterns, Thinking in Code" officially takes off.

Friday, May 20, 2016

Math & Art

© Phillips Academy

Here's a great example of PA students using the Addison Gallery to explore patterns and math through art: reconstructing Sol Lewitt's Wall Drawing #716.  We're going to be doing activities like this...although probably not this exact one...this summer during Seeing in Patterns, Thinking in Code.

Thursday, May 19, 2016

Swing-O-Matic

FiveThirtyEight has a fantastic interactive data visualization they are calling the Swing-O-Matic. It lets you fiddle with voter turnout and party preferences of various demographic groups to see what the impact would be on the upcoming presidential election.  It calculates both popular vote and electoral college.

See if you can tweak is so that the electoral winner and the popular winner are not the same!

Wednesday, May 11, 2016

The Importance of Understanding Algorithms

Is Facebook politically biased?

This question is in the news as a result of Gizmodo's accusation that Facebook intentionally distorts the "trending" list away from conservative viewpoints.

The New York Times' Farhad Manjoo has a must-read column, Facebook's Bias is Built-in, and Bears Watching, about the power of algorithms, not just to do complicated mathematics, but to sway human opinion and even elections:
“Algorithms equal editors,” said Robyn Caplan, a research analyst at Data & Society, a research group that studies digital communications systems. “With Facebook, humans are never not involved. Humans are in every step of the process — in terms of what we’re clicking on, who’s shifting the algorithms behind the scenes, what kind of user testing is being done, and the initial training data provided by humans.”
Understanding what algorithms are, and how computers sift and sort and shape data, is as important to citizenship in the digital era as is literacy.

Sunday, May 8, 2016

Do Toys Help Prepare Kids for Coding?


The Wall Street Journal is running an article, How Wooden Toys Teach Kids to Code, that posits that some forms of manipulative play (meaning they manipulate physical objects, not their parents) help kids prepare for coding.

It's a topic I'm interested in because teaching middle school and high school level coding it's clear that many kids could benefit from earlier exposure to some of the concepts.  Imagine if we taught no math, not even counting, until high school.  Just think of how overwhelming their first math class would be in the 9th grade. Some kids would intuitively grasp some of the concepts, but others...who might have been strong math students had they built up to it more slowly...would feel lost and discouraged.

That's pretty much what happens when we don't teach any programming or computational thinking until they are teenagers.  That doesn't mean they have to be writing recursive functions at 6 years old, but neither do we have them dividing fractions or factoring quadratics in elementary school. Instead we get them used to thinking in numbers and the four basic operations so that when they start doing "math" they're facile in the fundamental concepts and language.

We need a K-12 computational thinking curriculum that takes the same deliberate...and patient...approach to coding.

Getting back to the WSJ article, I'm curious if the article's suppositions are correct, that playing with these sorts of toys help prepare kids for coding.  For my part I'm an owner of Robot Turtles, and I've also pre-ordered (my bad, I mean "backed") the Kickstarter project Cubetto.  I'd like to believe the underlying assumption is true, but I'd also like to see some intentional research.

Tuesday, May 3, 2016

Public Speaking


I just heard on NPR an interview with Chris Anderson from TED (of TED Talks fame) promoting his new book on public speaking.  He posited that the culture of short videos that has arisen on the Internet in recent years has reinvigorated both interest and need for public speaking skills.

(NPR hasn't posted a link yet; I'll update when they do.)

Monday, May 2, 2016

Visualizing Disparity

The New York Times has some amazing visualizations of how income and race effect success in public schools.  Move your mouse over the data points to see what I believe is every school district in the country (are there even enough pixels to do that?)

Later this month in my Computer Science 450 course we are going to explore the technology used to make these visualizations.

Wednesday, April 20, 2016

The Andover Experience

Phillipian Board, 1897. Phillips Academy, Andover
In designing a hybrid course here at Andover, one of my goals is to make it an authentic "Andover experience" and not just a course (however great) with the Andover brand.

So what is the Andover Experience?

When I first arrived on campus I sat down with a variety of PA to ask them that, and the consistent response was that it's about the people.  There were some additional ideas offered (we'll get to that in a minute) but over and over again I heard a sentiment that I started generalizing as, "You form lifelong friendships with amazing people from around the world who aren't just like you."

I even got confirmation of that from a local landscaper I met who was saving money so his daughters could go to PA.  He went to high school in Lowell, and he described how all his friends were basically like him: born and bred in the Lowell area, still here and working here.  But one of his friends went to PA on scholarship, and his friends live all over the world and do interesting, diverse, sometimes incredible things.  He recognizes the importance of having peers with ambition, vision, and a range of backgrounds, experiences and values, and he wants that for his daughters.

So...how to do that in five weeks, only two of which are on campus?

One way bonds get formed is through facing challenges together, and relying on each other. Thus a core design principle in Seeing in Patterns, Thinking in Code is that students will rely on each other.  Often that will take the form of teamwork, but two of our recurring themes are Peer Feedback and Iteration.  That is, our work...whether individual or team-based...is never "done" after a single draft, but instead we improve our work over multiple drafts, and the way we improve it is by soliciting peer feedback.  The skill of giving and getting feedback is something we will explicitly scaffold and practice throughout the course.

Of course, while developing bonds with amazing people from around the world who aren't just like you is central to the Andover Experience, that by itself isn't uniquely Andover.

Another theme that has repeatedly appeared is that of Phillips Academy itself: literally the campus, the buildings, the facilities.  It is hard to imagine a true PA experience that didn't take place in and around 180 Main Street.  So another component to our 5-week experience is to get students to experience as much of the campus as possible.  They will be living in dorms, eating in commons, and using the athletic facilities, but we want to do more: we will be spending time in the Addison Gallery (speaking of 'uniquely Andover'), walking in the Sanctuary, using the new Makerspace, and otherwise exploring the nooks and crannies of PA.

In one of my conversations a PA community member said, "We'll know we've been successful if two years later the kids are still in touch with each other."  While it doesn't mean we will be unsuccessful if this doesn't happen, it is the outcome that has been guiding all our decisions for the course.

#d3BrokeAndMadeArt


One of my favorite technologies is a javascript library called d3, which stands for Data Drive Documents.  It was developed by Mike Bostock, who brought those amazing interactive data visualizations for the New York Times.  Here are two of my favorite examples:

(At least, I assume they are by Mike.  The NYT gives attributions for writing, for photographs, and for illustrations, but not for interactive graphics.  Go figure.)

The only problem with d3 is that it can be a little tricky to master, and complicated uses can easily go awry.  Turns out, though, that there's a hashtag for those misadventures: #d3brokeandmadeart.

It's fun to scroll through and see not only the strangely beautiful mistakes, but to get a sense of some of the cool things people are doing with d3.

Friday, April 15, 2016

Rethinking Teaching and Learning



Just before I heard the piece on NPR about Listening to Wikipedia I caught the tail of this story about Carl Wieman and his efforts to rethink the teaching of science.  He was always interested in science education (I worked with him on the Physics 2000 project in the late 90's) then after he won the Nobel Prize in Physics he leveraged his fame to really focus on science education.

The Minecraft Generation


The New York Times Magazine has a feature article, The Minecraft Generationabout the growth and influence the game Minecraft, and the cognitive skills it exercises.

The anecdote the story starts with, about an 11-year old boy named Jordan and the solution he found to a challenge he had created for himself exemplifies computational thinking.

Thursday, April 14, 2016

Listening to Wikipedia



I heard this on NPR yesterday and immediately checked out listen.hatnote.com.  It uses a live feed for Wikipedia edits, and turns them into sounds.  According to the site, "bells indicate additions and string plucks indicate subtractions. Pitch changes according to the size of the edit; the larger the edit, the deeper the note."

Not only is it hypnotic, but reading the titles of the entries that are being edited is fascinating.

Monday, April 11, 2016

William Hamilton, 1939-2016

I just read that a Phillips Academy alum, William Hamilton '58 passed away over the weekend.  He was a writer and illustrator who wrote cartoons for the New Yorker...surely one of the coolest jobs on the planet...for just over 50 years.

© Phillips Academy.

Cartoons are an underutilized educational resource.  I was thrilled to learn that Randall Munroe, creator of my favorite web comic, xkcd, has been participating in writing textbooks

Here's one of my all time favorite, if non-typical, of his strips.  It's a visualization of partisanship in the United State Congress since the founding of the country: 
https://xkcd.com/1127/
I'd love to get Mr. Munroe to come be a Tang Institute speaker.