High school CS teachers need to read and trace code, not develop software

May 30, 2014 at 8:23 am 31 comments

My May 2014 Blog@CACM post, “What it takes to be a successful high school computer science teacher” sneaks up on a radical suggestion, that I’ll make explicitly here.  High school computer science teachers need to be able to read and trace code.  They don’t necessarily need to know much about writing code, and they certainly don’t need to know how to be software developers.

As we are developing our CSLearning4u ebook, we’re reviewing a lot of our prior research on the practices of successful CS teachers.  What do we need to be teaching teachers so that they are successful?  We don’t hear successful CS teachers talking much about writing code.  However, the successful ones read code a lot, while the less-successful ones do not.  Raymond Lister has been giving us evidence for years that there’s a developmental path from reading and tracing code that precedes writing code.

Yes, I’m talking about taking a short-cut here.  I’m suggesting that our worldwide professional development efforts for high school teachers should emphasize reading and tracing code, not writing code.  Our computer science classes do the reverse of that.  We get students writing code as soon as possible.  I’m suggesting that that is not useful or necessary for high school teachers.  It is easier for them to read and trace code first (Lister’s studies) and it’s what they will need to do most often (our studies).  We can reduce costs (in time and effort) of this huge teacher development effort by shuffling our priorities and focusing on reading.

(We do know from studies of real software engineers that they read and debug more than they write code. Maybe it would be better for everyone to read before writing, but I’m focusing on the high school teachers right now.)

About these ads

Entry filed under: Uncategorized. Tags: , .

Google finally discloses its diversity record, and it’s not good: Everybody else? NCWIT Summit 2014: Changing Computing Education in US States

31 Comments Add your own

  • 1. alfredtwo  |  May 30, 2014 at 8:56 am

    What code are they reading? I’m an outlier in some regards because I was a software developer for many years before going into the classroom so I have both developed and read a lot of code.

    Reply
    • 2. ebujakEd Bujak  |  May 30, 2014 at 12:33 pm

      I agree with Alfred. I was also a software developer before becoming a teacher. I often said, as a developer, that you become great at writing great software (fast/efficient/elegant/readable) by reading the code that the great developers write..

      Reply
  • 3. shriramkrishnamurthi  |  May 30, 2014 at 9:12 am

    As do students! May I immodestly plug our recent work that is now part of a much larger ongoing project? A few universities are planning to pick up on this infrastructure for the fall.

    http://cs.brown.edu/~sk/Publications/Papers/Published/ppkf-ct-multi-stage-in-flow/

    CaptainTeach: Multi-Stage, In-Flow Peer Review for Programming Assignments

    Computing educators have used peer review in various ways in courses at many levels. Few of these efforts have applied peer review to multiple deliverables (such as specifications, tests, and code) within the same programming problem, or to assignments that are still in progress (as opposed to completed). This paper describes CaptainTeach, a programming environment enhanced with peer-review capabilities at multiple stages within assignments in progress. Multi-stage, in-flow peer review raises many logistical and pedagogical issues. This paper describes CaptainTeach and our experience using it in two undergraduate courses (one first-year and one upper-level); our analysis emphasizes issues that arise from the conjunction of multiple stages and in-flow reviewing, rather than peer review in general.

    Reply
    • 4. Michael S. Kirkpatrick  |  May 30, 2014 at 10:32 am

      I love this! I’m going to have to take a look at this, because I feel the same way that students need to learn to read code.

      Reply
  • 5. astrachano  |  May 30, 2014 at 9:16 am

    I know I’m stepping into a possible quagmire here, but have to. First, there are some logical fallacies in play regardless of whether reading/writing first is a good idea. The last parenthetical comment, “we know real software engineers read and debug more than they write, so it’s better for everyone to read before writing” is flawed at many levels. First, the idea that the practices of real software engineers should be relevant to beginning teachers isn’t justified — and the fallacy here is easy to spot. The practices or software engineers/developers don’t necessarily apply to other groups, e.g., teachers. Also, there’s no temporality in “we do more X than Y” so we should do X before Y.

    I’ll write more in a bit, but the reasoning here is just wrong.

    Reply
    • 6. alfredtwo  |  May 30, 2014 at 11:08 am

      Professional developers do a lot of their learning by reading code. In fact most of the ones I have worked with would rather read a bunch of sample code that does things than to try and figure it out from a manual.

      Reply
  • 7. gflint  |  May 30, 2014 at 10:37 am

    The original article looked at APCS teachers. APCS teachers and students are not typical. If I had my Freshmen do nothing but read and trace code I would have no Freshmen. Kids want to build stuff. They will spend hours building a simple maze game with Scratch or Pong in Small Basic and learn a lot of programming on the way. Reading and tracing code is a very important skill and is a very useful teaching strategy but it is really low on the fun scale. While CS is an elective it has to be fun and interesting. Get kids building something in class quickly, even something simple, then integrate reading and tracing code. As far as teachers being good programmers – no. But they better be able to write basic code in a couple of languages and be able to learn a language in a hurry. The only way to learn a language is to fumble with it a lot. Teaching programming is teaching the kids to fumble, troubleshoot, and problem solve. I do not think reading and tracing code does all that.

    Reply
    • 8. Mark Guzdial  |  May 30, 2014 at 12:32 pm

      Did anyone suggest that students “do nothing but read and trace code”?

      Reply
      • 9. ebujakEd Bujak  |  May 30, 2014 at 12:54 pm

        I think there are two sides in a CS class that involves programming. Most students produce more code then they read, most teachers read/evaluate the students code more than they write. Teachers need to be critical and efficient at evaluating code assuming the assignment is more than a multiple choice exercise and more than simple 2 line syntax responses to test understanding of a prompt. Watching programmers for many years has shown me that great programmers are great at very quickly reading code and document snippets and extrapolating that and integrating those ideas into their code. To survive as a real developer you are integrating libraries, packages, hardware, etc. all from different groups. You must become good at reading code and docs.

        Reply
  • 10. Shawn  |  May 30, 2014 at 10:45 am

    The ability to trace code is so important. Funny, as I read this I am sitting here working with a student who has been struggling. She is tracing the two silly little blocks I wrote for her — just so that she could practice tracing.

    The first thing I do when I sit down with a student who can’t understand why their code doesn’t work is to pull out a piece of paper, scold them for not having any paper in front of them already, and start to trace what I see. They are so resistant to tracing, but I put it on many quizzes and nag them relentlessly about the important of tracing what the code is actually doing as opposed to unproductively staring at it while repeatedly stating what they intended the code to do.

    Reply
    • 11. ebujakEd Bujak  |  May 30, 2014 at 12:44 pm

      It compiles so why doesn’t it work? :)
      I say something like; “John ran the quickly street across.” and they look at me puzzled. Just because it passes grammar (syntax rules) does not means it makes any sense (semantics). As a software developer and math/CS teacher, tracing is important. CS teachers, as this blogs confirms, trace programs a lot. Teachers in other subjects do the same. Hopefully they are tracing and reading the students’ work to assess their understanding and adjust their teaching. Does anyone show intro CS students a debugger … well when the time requires a debugger? :) I do and the students really appreciate what serious developers do with complex systems. Just In Time (JIT) is great.

      Reply
  • 12. gasstationwithoutpumps  |  May 30, 2014 at 7:04 pm

    Ed Ujack gave the following bad example: “I say something like; “John ran the quickly street across.” and they look at me puzzled. Just because it passes grammar (syntax rules) does not means it makes any sense (semantics). ” The problem is that his example fails syntax checks, not semantic ones. A classic sentence with the problem he wants is “Colorless green ideas sleep furiously” (which I believe was originally Noam Chmosky’s). In our household, we often replace “Good night!” with “Sleep furiously!”

    Reply
    • 13. ebujakEd Bujak  |  May 30, 2014 at 8:11 pm

      gasstationwithpumps is correct about my incorrect “sentence.” Chomsky does a much better job including your “Sleep furiously!” adaptation of another of his popular examples. Thanks for the great
      reference.

      Reply
  • 14. Peter Donaldson  |  June 1, 2014 at 3:54 am

    It’s interesting that what we’ve focused on in the PLAN C (professional learning and networking for computing) programme is mostly about giving our teachers a richer set of techniques for developing novices code comprehension and reasoning skils.

    We’ve drawn on a broad body of CS ed research to do this including Rays work, Carsten Schulte’s Block model, Quintin’s Abstraction Transition Taxonomy and Juha Sorva’s Notional machine as well as synthesing some new techniques of our own.

    Our hypothesis is that computing in general, but programming in particular, relies heavily on mechanistic reasoning. A program is a description of a process you’d like the computer to carry out on your behalf. This means that as you’re developing it you need to be able to understand it causally as a set of actions carried out by some notional machine.

    The other major stumbling block is that if your mental model is inaccurate or incomplete then you’ll really struggle
    due to the fundamental nature of code as a precise, unambiguous instruction that’s interpreted in a specific way. If you rely on intuition or something you’ve seen that’s similar you’ll never make much progress towards independently writing code of your own.

    You can find out a little bit more about it by visiting http://www.plan for computing.org.uk

    Reply
    • 15. Mark Guzdial  |  June 1, 2014 at 10:19 am

      Peter, the URL you left was incomplete. I found some information on PLAN-C here: http://www.casscotland.org.uk/plan-c/. Is there another website with more information?

      Reply
      • 16. Peter Donaldson  |  June 1, 2014 at 2:34 pm

        Hi Mark, we’ve published the teacher information leaflet on casscotland.org.uk but the http://www.planforcomputing.org.uk URL will eventually point to a separate website with more information.

        The other areas we have are moodle courses where our lead teachers can login to access the presentation, notes and activities.

        We’re just about to finish our last lead teacher hub which will give us 50 leads and 27 local hubs and we have over 100 teachers signed up this week for the local hubs with a target of 300-450 which would be 50-70% of all the GTCS registered computing teachers in Scotland.

        If you drop Quintin or myself an email we could chat about what we’re doing in a bit more detail. I’d be quite interested to see how it compares to the CS4Edu work you’re undertaking at the minute.

        Reply
  • 17. fgmart  |  June 2, 2014 at 1:56 am

    I’d agree that from the teaching standpoint, yes, reading (and commenting on) students’ code would be the most important thing. (Definitely where teachers would invest most of their time.)

    My question is – how would novices learn enough about how code works to be good at doing this?

    It might involve writing code.

    Reply
    • 18. Mark Guzdial  |  June 2, 2014 at 6:55 am

      That is exactly the question I’ve been wondering about. How much coding is needed?

      Reply
  • 19. Baker  |  June 3, 2014 at 7:18 am

    It’s a floor wax AND a dessert topping! https://screen.yahoo.com/shimmer-floor-wax-000000185.html
    This year I experimented with having students do a double-blind peer review of every assignment they turned in. Their grade was based partially (20%) on the quality of the feedback that they gave other students. But it wasn’t just free-form comments. They had a checklist of criteria that they had to READ THE CODE to find out about. For example, one of the criteria might be: “The student broke the problem down into at least 3 well-named methods that were combined to solve X”. With guided criteria like that students were actually much better able to find mistakes and make good critiques of their peer’s code – I think because they just wrote the assignment themselves and knew what to look for and were interested in how another student did it. They were actually much better than I was since I’ve forgotten certain things about my own assignments.
    Anyway, the results of this experiment (anecdotal) were that:
    a) my students ended up reading about as much code as they wrote
    b) within a few short weeks the class on a whole was writing MUCH better MUCH cleaner, more readable code – it only takes a few classmates to tell you that your variable names are stupid and confusing for you to stop doing that.
    c) students got much more feedback that they had in the past
    d) residual benefit I had not anticipated: they were much better working in teams, I think because the peer review boosts some confidence, or at least takes the mystery out of writing code yourself in a black box.
    All of this to say, that I have come to value the value of reading code BUT, I would NEVER have students read code to learn a topic. They must write it first. They are interested in reading code when it’s a problem they’ve solved and they want to see how someone else did it. Also, they were genuinely interested in helping each other. It was nice. The double-blind process is essential. I used Moodle’s peer review module, which isn’t fantastic but gets the job done.

    Reply
    • 20. Mark Guzdial  |  June 3, 2014 at 7:28 am

      Baker, could you explain your comment, “They must write it first.” Why?

      Reply
      • 21. Baker  |  June 3, 2014 at 9:42 am

        To be clear, they are not writing without guidance. The problems are setup so that they only have to apply a few coding elements in creative ways to solve the problems (think: karel the robot). Also, when students in my class write code it is not as if they haven’t seen and read a lot of code first (through in-class presentation, etc.) But I think we’re talking about critical evaluation of code and programming solutions here, not just comprehension, right?

        Without writing first students have very little frame of reference or appreciation for the solutions they are reading, are not really able to critically evaluate others code as well. When they read their peers’ code they also see how many different ways there are to solve the same problem, and it helps get around students’ common misconception that there is a fixed programming answer to any problem.

        So, when we discuss the reading/writing analogy for programming I think many people in their minds conflate it with reading/writing english. The analogy does not obtain.

        Programming is more like building than it is like writing. The better analogy is woodworking or shop class. Programming is a tool. Tools can do certain things. In a woodworking class a teacher shows students how to use say, a saw, and sandpaper, and hammer and nails, and gives the students the challenge of making a box. The first time through, the students are going to make some pretty crappy boxes, but they will be boxes. AT THAT POINT the student’s mind is much more receptive to the more finite points of skill required to make a box. AT THAT POINT if students study other boxes, both well-made and poorly made, their experience will provide a frame of reference for critically evaluating the making of the box. Students will have a much better understanding of their own skill.

        Now imagine that the instructor did the study of boxes first. At the very least I’m willing to bet that the lessons of that study wouldn’t sink in, and would need to be reviewed after the building in order for the understanding to really transfer. Worse, imagine if the class was ENTIRELY about looking at tools and how they work and studying fine woodworking products and the students never touch the tools! (NOTE: I don’t think that’s what you’re suggesting, just extrapolating the extreme case).

        Other things that I think need clarification here:

        1) It’s possible we don’t understand each other in what mean about “reading” and “writing” code. It’s very possible that, especially early on, what I call “writing code” might not be that far from early attempts at what you mean by “reading” and vice-versa.

        2) It’s possible we have actually conflicting views about the purpose of a CS class especially in terms of which and what types of skills students should have coming out of the class.

        3) It’s possible that there is a chasm here between K-12 and College-level CS courses and the needs of students at those levels that should be discussed. Everything I know about K-12 education, and basically makes up the fiber of my being, says that students need to DO. Learning and understanding come through “the doing” of authentic tasks in which students must produce work in the real world.

        Reply
        • 22. Mark Guzdial  |  June 3, 2014 at 11:50 am

          I’m not talking about kids in my post, or in my questions here in the comments thread. I’m talking about teachers.

          You offered a thought experiment, so I’ll respond in kind. If you don’t read code before writing it, then what do you know how to write? At the very beginning, you have to read some code first to know the syntax for what you write. Before you pick up the hammer, you saw someone use it, right? You might be right that you can’t get the finer points without writing some code and getting the experience of building. I’ll bet that you read differently (papers, stories, whatever) after you start writing them. But I don’t know what’s necessary, where the line is: “You can learn up to here by reading, but you have to have experience writing to go further.” Can we scaffold reading such that you get as much conceptual learning out of that as writing? Or at least, require less time writing, i.e., make the learning from writing more efficient? I really don’t know — it’s an empirical question.

          I like to read programming language books. I’ve read far more code than I’ve written. I’ve read code in languages I’ve never written in. I’m unusual, so that leads to my question.

          Finally, I suspect that you’re confounding the goals. I want teachers to learn how to read and comment on student work. You want students to engage in peer-review. I completely get that peer review requires some engagement in the product — I think we see that in the work of Chris Hundhausen, Martha Crosby, Hari Narayanan, and all the others who have been exploring coding peer reviews in the CS studio-based learning model. Reading for peer review isn’t the same as reading for learning.

          Reply
          • 23. Baker  |  June 3, 2014 at 12:15 pm

            I confess to the mixing up of goals below. Sorry about that. I plead that I was egged on by other comments :)

            My response to your thought experiment is:

            1. I agree we need to find where the line is between seeing the hammer demonstrated and students using it that increases learning. Certainly watching the teacher use the hammer has diminishing returns at some point.

            2. When you read code in books, even in other languages, what you picture in your mind I bet is a structure or systems of structures that the code is manipulating. Where did you get that picture from? Furthermore, and this is the more important point: in reading the code in those books, how do you have any sense or wherewithal to know whether it’s correct or not? I argue that you have some sort of visceral sense of the machine and what it can/cannot do that makes the algorithms involved valid or not. It’s plausible you didn’t get that sense from programming yourself, but did you?

            3. The analogy to reading/writing in English is, I think, bogus, but again depends on what kinds of skills you imagine students having. Reading English has cognitive benefits and rules that are (or can be) completely divorced from the act of writing. If I write a story or lay out an argument in prose, it is entirely and abstraction in my mind that I’m trying to communicate to you, the reader. You enter my world, and if you don’t like what I have to say, that’s like, your opinion, man. This is not true with reading/writing code. There is at some level a set of rules we agree to abide by about how the machine works. I have an ability to evaluate your code based entirely on logic and facts, and a shared understanding of the principle rules involved. This bonds the acts of reading and writing code much more strongly than in natural language, I think.

            Reply
    • 24. Peter Donaldson  |  June 3, 2014 at 8:31 am

      Hi Baker,

      I’m not sure that we do need students to do lots of code writing first. Anecdotally at the moment, from my own classroom experience and the PLAN C leads we’ve trained, a comprehension with writing based approach seems to result in a wider range of pupils able to understand and apply the key ideas.

      Combining a richer variety of investigative comprehension exercises with some simpler independent code writing of their own has completely changed my view about whether CS for all is possible. You could say it’s been the equivalent of a Threshold Concept but for teaching CS rather than understanding it.

      Reply
      • 25. Baker  |  June 3, 2014 at 9:45 am

        See my reply above to Mark. It’s possible we don’t disagree here. I think we need to clarify much more clearly about what we mean by reading and writing (see clarification point #1).

        Reply
  • 26. Baker  |  June 3, 2014 at 9:59 am

    Addendum to notes above…it appears that somewhere in there I (we) lost the original thread which is about what high school teachers need in order to be prepared to teach CS classes. It somehow morphed into arguments about the student experience.

    I’m not sure how I feel about this argument in terms of PD. Teachers being (for the most part) educated adults might be able to grapple with code through more reading than creation, but I don’t know. I’ll have to think about it more.

    Reply
  • 27. alfredtwo  |  June 3, 2014 at 2:00 pm

    There is a difference between learning how to use tools and learning how to make things with those tools. Reading code can often tell us if a student is missing the tool (syntax errors, typos, etc.) but without some deeper understanding of software development understanding why the artifact doesn’t work can be a struggle.
    I’ve got some students working on a program that involves a bunch of buttons. There are lots of ways to do this including some that involve many many lines of code. I can read that code and let them know where their mistakes are and help them understand cut/paste and edit easily. teaching them that there is a better way (my sample has about 90% fewer lines of code) is for software development.
    In a first course maybe how to use the tools is fine but eventually we want them to construct meaningful artifacts and that requires someone who understands something about software development.

    Reply
    • 28. Mark Guzdial  |  June 3, 2014 at 2:19 pm

      That makes sense, Alfred — if you’re teaching students to do software development, we want the teacher to understand software development. Do we need to teach software development in high schools? In every high school? Or is it sufficient to do ECS and CSP in all high schools, and leave software development for undergraduate or for those (fewer) schools that can afford to teach it?

      Maybe we do want software development in every high school, but we should make that decision explicitly. We don’t have to put software development into every CS class in every high school. If we do decide to do emphasize software development in the high schools, we have to figure out how to keep those teachers in the high schools when the economic pressures will encourage them to go off and be software developers.

      Reply
  • 29. Bri Morrison  |  June 4, 2014 at 2:17 pm

    So I’ve been thinking about this for a couple of days now. I understand the need to make educating teachers more efficient. However, I also grok Baker’s idea that after having written the code, I’m much more likely to spot errors or improvements in others’ code. In addition, what about the teachers creating their own assignments. I’ve had the unfortunate experience of giving an assignment (that I had not yet written the key for) that turned out to be way more difficult that I originally thought…requiring too many error checks to actually get something done. When I wrote the program I realized it and had to change the assignment. If the teachers aren’t comfortable writing the solutions to their assignments they could end up in the same situation.

    So the teachers learn by reading and “tweaking” lots of code (good for exploration). When and how do you migrate them to writing code? And how much code? I see some very interesting empirical study ideas!

    Reply
    • 30. Mark Guzdial  |  June 4, 2014 at 3:21 pm

      And where will CS high school teachers get their assignments — writing the assignments themselves (like most college teachers? pulling out of a curriculum? pulling out of a testbank? I don’t know that we know the tasks of the average CS high school teacher yet, and how it will change in the future.

      Reply
  • 31. Peter Donaldson  |  June 6, 2014 at 4:07 pm

    Hi Baker,

    we probably don’t disagree but maybe I need to be a bit clearer about the kinds of comprehension work we do. For example we do have a cooperative learning activity called pedagogical code review which involves students evaluating two different solutions to the same problem and evaluating which is better. However it’s an activity that would happen towards the end of a course to help consolidate their understanding rather than at the start.

    Comprehension techniques at the start are much lower level and mostly involve developing a stronger understanding of individual lines and blocks in terms of their function, behaviour and structure.

    The implications of learners working with an unambiguous formal language rather than a context dependent natural language make a world of difference. If we rely on students inferring the operation of some notional machine through writing lots of example programs rather than trying to develop some of that understanding directly many are likely to develop a partial or incorrect mental model. Without a viable model we think it’s extremely difficult for novices to reason about an incorrect or partially correct process description.

    Reply

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

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent Posts

May 2014
M T W T F S S
« Apr   Jun »
 1234
567891011
12131415161718
19202122232425
262728293031  

Feeds

Blog Stats

  • 949,301 hits

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 3,058 other followers

CS Teaching Tips


Follow

Get every new post delivered to your Inbox.

Join 3,058 other followers

%d bloggers like this: