Writing versus programming

There’s a very popular reddit post quoting a slashdot comment that am now blogging about. (Ooh, I should tweet about this blog post afterwards! Internet!)

Anyway, the commenter suggests that programming and writing are the same activity, and justifies this with their experience with learners of both languages and programming languages. As usual with things I get the urge to comment on, they’ve got some things right and some things wrong.

They’re definitely right about one thing: they’re seeing a very deep similarity between people who very effectively know about the [programming] language, but can’t actually use the [programming] language. They suggest:

We should be immersing students in good code. We should be burying them in idiom after idiom after idiom, allowing them to acquire the ability to program without explanation.

Great idea. One that should be done, of course, but it’s also not the whole story.  In keeping with our writing analogy, let me paraphrase another bit of writer advice: “If you want to be a good writer, write! And keep writing.”  This is also important: you can’t just know about the language, you can’t just read the language, you’ve got to write the language. And that goes for programming, too.

How many programming classes have you taken (or taught!), where you had to code only two or three smallish programs? Or less? Asking for good programmers to be generated by a system like this is indeed quite like asking for good writers to be generated from a system like this.  Except that people are asked to write from, what, sixth grade (about 12 years old) or earlier? And people are expected to write in far more than just their writing classes.  (I could go on about how we should be teaching programming to everyone starting that young, but that’s a rant for another day, though I’ve hinted at it before.)

So is programming like writing? Nope.

Wait, we just went through this really deep analogy that works really well, how could it not be the real story? Well, it’s kind of like confusing correlation and causation.  The problem is, this same similarity can be said for teaching anything.  Really.  Check out this wikipedia article on the cognitive domain of Bloom’s taxonomy.  “Knowledge” (aka knowing about something) is the shallowest of learning.  Teachers, of any subject, should know this stuff. Richard Feynman wrote about seeing the exact same problems in physics students when he visited Brazilian universities way back when.  Surely physics is not like writing? ;)

And then there’s some important ways programming and writing differ.  For one, writing is meant to be read. Code is meant to read and changed.  By itself, this makes these two activities completely different. Imagine if an editor sent feedback to a writer like this: “Why are we mentioning anything about Ron’s thoughts here? The title of this book is Harry Potter. Please refactor this out to a separate book called Ron Weasley and the OH GOD A SPIDER. On second thought, that’s a terrible name. We might decide in the future that Ron should love spiders. What Ron Weasley Thinks of Spiders.”  (This is not to suggest that writers don’t revise their work. They do, of course, but they don’t design their work around making revisions, they design it around being read.)

I should be writing something else right now, so let me kill this post with an exercise for the reader: what programming activities fit into what levels of Bloom’s taxonomy?

One more random thought: has anyone ever tried peer review of code in a programming class? (And I don’t just mean pair programming…) I’d be curious to hear how it was designed / how it went.

This entry was posted in Teaching and tagged , . Bookmark the permalink.

4 Responses to Writing versus programming

  1. Silas Snider says:

    When I was an undergrad, I took a class in Python where we did something like peer review of assignments — the GTF that taught the class would print out everyone’s submissions, and hand a copy out to everyone in the class (anonymized of course). He would then spend some class time having us all look through it while he mentioned things that each piece of code did well and which things it did poorly. Fellow students could ask questions about segments of code, and he’d explain things. This was amazing for two reasons: I felt like I was able to learn idiomatic python much more quickly this way, and it gave me a way to see how turning in homework benefited me other than the grade it bestowed.

  2. Pixley says:

    In my assembly class, we did a sort of peer review. One person writes code, but cannot compile. After x amount of time, everyone moves seats. The second person may compile, but cannot run. Fix any compilation errors, change logic flow if necessary, etc. The third person may run the code, and must produce a working version of the program to the professor.

    (ed note: fixed typo)

  3. Marty says:

    Except that Harry Potter is literary fiction whereas programming is a branch of technical writing, where I could certainly imagine that kind of exchange.

  4. Goodbye World says:

    Title: PLEASE READ BECAUSE I WROTE A LOT- just kidding- title: coding and writing comparison

    This is my view about the similarity between coding and writing: In both cases, you’re narrating something; for example, say you want to narrate a boy running:
    -writing: “The boy was running.”
    -coding: “variable Boy = {image of boy} –> repeat5times: moveBoyforward”
    In both cases, you are narrating something or trying to make/program an image of a boy running.
    Another similarity:
    In coding, you are telling a computer to do something so that you make up (let’s say) an animation, so you program; then, you finish your program, so the computer reads it and the console runs it.
    In writing, you are writing a book to make up (usually) a story, so you write; then, you finish and publish your writing, so others read it: in this case, the author acts the coder, the reader acts the computer and the console acts your imagination.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s