Skip to content

Programming Poetry

2010 November 30
by Hélène Martin

My mind has gone blank
Now as void as a method
that does not return

I like to give my students a creative 1-point extra-credit question on bigger assessments.  It buys me a bit of goodwill while balancing out small mistakes students make when they are rushing, unclear questions and the like.  I also get a glimpse of students’ true feelings for programming as well as some information about how deeply they’ve internalized concepts.  For example, the author of the poem above clearly has a good understanding of returns and the meaning of void.

I just gave my AP CS students a quiz and encouraged haikus for the extra credit.  The results were stunning.

Will a char suffice?
no, you must use a string. Why?
for it has methods

Check them all out.

As most good ideas, this one comes from UW CSE.

Follow Up: Programming Assignments for Mental Models

2010 November 22
by Hélène Martin

There’s snow in Seattle which means that I can see a half dozen emergency vehicles and accidents from my window and school is closed.  For a change, I’ll actually have time to think tomorrow instead of madly scrambling through the day.  I don’t think it makes sense to expect consistently thoughtful, quality teaching from people in front of a classroom 5 hours a day, every day.  But never mind that.

I just had an excellent discussion with Mark Engelberg about the Space Needle assignment I referred to in my previous post.  He had a lot of great things to say.  First he noted that without the scaling, it’s definitely a “bad” assignment because the results could be obtained with a big print statement.  He also points out that it’s not really “about something” — it doesn’t provide insight into any interesting domain.  Yes, I think that’s mostly true.  And part of my point is that I don’t believe that matters so much at first.  Lots and lots of people completely disagree with me, though, and I think they have fine arguments, though I don’t agree with all of them.  For example, I think that the act of programming itself is pleasurable, even when solving totally contrived problems.  Also, my (lofty) goal is to quickly scaffold students to a point where they can apply skills to domains they are interested in.  I’m willing to sacrifice real context in early assignments to get there.

One thing I noted is that this assignment has, in my experience, provided insight into who will breeze through the course and who will struggle.  That’s very important information to have early on.  I think it’s a nice predictor because it requires a reasonable mental model of state and an ability to find patterns.  Really, it’s an algebra problem more than anything else: it requires writing an equation representing the number of each character type and using that as a loop bound.

I think I forgot something important about “good” early programming assignments: they are a proxy measure for specific, intangible mental models.  I wish I could dissect students’ brains and see how they’ve conceptualized memory allocation but that would probably violate some laws.  Instead, both test questions and assignments have to give me information on what misconceptions, if any, students have so that I can correct them.  Perhaps more importantly, students also need to be given ample opportunity for targeted practice to build mental models over time.

I think this is again an example of Stuart Reges’ influence on me.  He wrote an excellent SIGCSE paper a couple of years ago called “The Mystery of b := (b = false)” (PDF) which has colored the way I look at practice and assessment in my programming classes.  The paper talks about an interesting question from the 1988 Advanced Placement computer science exam.  The test was then given in Pascal; the question in Java would be:

If b is a boolean variable, then the statement b = (b == false); has what effect?
(a) It causes a compile-time error message
(b) It causes a run-time error message
(c) It causes b to have value false regardless of its value just before the statement was executed.
(d) It always changes the value of b
(e) It changes the value of b if and only if b has value true just before the statement was executed

What Stuart found is that this question was relatively strongly correlated to others on the test.  He goes on to identify 4 other questions that also are good predictors of students’ success on the rest of the exam.  One of Stuart’s conclusions is that these types of questions make for good practice questions because they target specific mental models and allow students to “debug” their reasoning.   I think that’s a strength of the Space Needle assignment and others I like to use.

In my last post, I said that it was most important that assignments gave students a sense of ownership.  After thinking about it more and discussing with Mark, I changed my mind.  So here’s my ordered list of the most important characteristics for an (early) introductory programming assignment:

  1. Targets specific skills to develop
  2. Gives students a sense of ownership/pride
  3. Has clear requirements and expected outcome (does not cause unnecessary frustration)
  4. Provides a proxy measure of specific computational mental models

What Makes a Programming Project “Good?”

2010 November 21
by Hélène Martin

I was drawn to computer science when I realized how endlessly creative programming can be.  I was thrilled by my new-found ability to build useful things at my own pace, for free and while solving interesting puzzles.  I hope to re-create this feeling in all my high school students.

I think programming projects are CS instructors’ best tool for capturing student interest.  This may seem like a non-statement but many CS educators have spent a lot of time distancing themselves from programming, especially for the early courses.  I’m torn.  I agree that computer science tackles issues beyond programming such as algorithm complexity or computability.  I know that programming without regard to human-computer interaction or advances in artificial intelligence can be useless or worse.  But programming provides such a great way to formalize algorithms and is such an impressive creative medium that I can’t really imagine discussing these other fascinating ideas without it.

So for me, finding “good” programming projects is critical.  Lots of things can make or break an assignment but I feel like the single most important factor is whether students feel ownership of what they create.  My take on ownership is probably controversial — I don’t necessarily mean that students should have the freedom to design what they work on.  I think that projects should result in complete artifacts that students understand inside and out.

I make heavy use of CSE 142 assignments from the University of Washington because I feel they exemplify this principle (or I feel strongly about this principle because of UW CSE’s influence on me).  I also have found many of Kathi Fisler‘s Scheme projects consistent with it.  These projects are all deliberately structured to give students practice on one or two core ideas as they produce a meaningful result.  Because they are scoped to emphasize only a few principles, the results may not always be very flashy but I don’t think that matters so much to students, especially in the first few weeks of programming.  It feels like a lot of instructors feel pressure to have students produce professional-looking results immediately.  But do students really care?  I clearly remember being thrilled at programmatically printing out multiplication tables… it was much more about feeling like I had power over the computer and could understand is inner workings than about the results themselves.  Even now, I get a rush from a simple “hello, world” in a new context.

Early on in my AP computer science course, I give a project that requires students to print out a Space Needle made of text characters.  This is of course straight from CSE 142 and their assignment writeup can be found by scrolling down to homework 2 here.  I think this is a brilliant project.  Sure, similar projects have been given since the 70s and it’s not particularly useful, but I have never heard students complain about that.  On the contrary, it’s not uncommon for students to cheer when they finish.  They also have a great mental model of procedural decomposition and of definite loops, the only two significant ideas needed to complete the project.

I’m wary of early projects that make heavy use of libraries.  I find (anecdotally) that when students don’t understand what they’re working with they don’t feel as satisfied with their results, even when those results are impressive.  Before getting my current position at Garfield high school, I spent six months visiting various classrooms.  I saw some really amazing teachers and classes but I also saw several classes in which students who had produced great-looking artifacts couldn’t explain the first thing about them and couldn’t generalize their knowledge to any other situation.  It didn’t seem very satisfying to them.

It’s not that I think students should write everything from scratch.  In fact, I agree that learning to work with existing code is a really important skill.  The Advanced Placement computer science exam requires learning and using a library called GridWorld and I’ve found it great to work with once students have the background to understand it.  They find it really cool that they can read the GridWorld code, understand it and interact with it to build things like this ant farm simulation from Robert Glen Martin (who has other great projects on his site).  Although there’s a lot of existing infrastructure for this project, students own it because they understand GridWorld and the few new big ideas (interfaces, abstract classes) emphasized in the project.

I also think it’s very important that projects be thoroughly scoped and explained.  In a college senior-level networks class, it may be ok if students have to flounder to understand what’s even being asked or fight with incomplete libraries.  For introductory students, though, that can be deeply frustrating and even get them to steer clear of computing.  Assignments generally take time to attain a significant level of polish which is why I prefer to use others’ time-tested masterpieces.  The nifty assignment archive is another good starting point for finding fully-baked project ideas.  My favorite from that set is the star map generator which has been a hit in my introductory Python class.

I try to choose assignments that deliberately build up students’ knowledge, thus reducing anxiety and increasing a sense of ownership.  I have found a set I like from various sources but I’m always on the lookout for other great assignments and project ideas to help get my students excited about the possibilities of computing.

My Jeannes and Johnnys can program

2010 October 9
by Hélène Martin

The article Why Johnny Can’t Program: A New Medium Requires A New Literacy spread like wildfire and was promptly commented on by every blogger I read so I figured it would be interesting to hear what my students had to say about it.  I’m lucky to be working with a class full of students with previous programming experience who are all intrinsically motivated — I’m in teacher heaven with them.  We are working towards the Java Advanced Placement test in May but we have a lot of time to play with deeper computer science material.  I told them at the beginning of the year that one of my goals was to give them a sense of computer science and programming culture so we’ve been doing readings on things like the nature of computation and essays like Paul Graham’s Holding a Program in One’s Head.  We’re also exploring functional programming through the excellent How to Design Programs.

When we do readings, I try to give students two or three questions to reflect on and we have a lightning conversation at the beginning of a period.  I try not to interject much and let the conversation go where it will.  A few students commented on my post and I recommend taking a look at those for a glimpse at what we talked about.  The discussion itself was great and several excellent points were brought up:

  • You don’t need to program to understand applications any more than you need to understand electricity to use a toaster — that’s a bogus argument.  Most students agreed with that.
  • Most agreed that making programming required wouldn’t be a good idea.
  • Making sure there are well-educated programmers around is about economic stimulus on a national/global scale, not just about individuals getting jobs.
  • Programming is a tool to support effective participation in many fields.
  • The national security threat is real.  Students could point to examples of cyber-terrorism and high tech weapons I had never heard of.
  • Why is any course required in high school?, asked some students.  What is social studies for — it’s certainly not about getting jobs as historians.  What is art for — it’s not about getting jobs as artists.  It’s about getting multiple lenses to view the world through and acquiring context to make critical decisions in life.  A lot of nodding there.
  • Programming languages, through abstraction and other deep concepts, help us understand cognition and how the world works.

I was really inspired by the discussion.  These students are articulate, thoughtful and understand where computer science fits in better than many programmers I know.  Some of them want to be computer scientists but many are just deeply curious about the world they live in and see programming as an opportunity to better understand it.  They work hard not for the sake of getting high-powered jobs or whatever other pursuit but just to be well-rounded.  There’s a lot of pessimism about America’s youth but there’s no denying that the upper end of students are truly thriving in this era of ubiquitous access to information.  Not only are they curious, but they also know exactly where to look to satisfy their curiosity.

My Jeannes and Johnnys can program.  Many have been dabbling in programming since they were young and I’m really lucky to be involved in helping formalize and direct their knowledge.  Because they all choose to be there, we can move at a fast pace, I don’t need to use carrots and sticks, and we can take the time to tackle some of the field’s big questions.  Would mandating computer science in high schools reproduce this kind of learning environment?  Or would it instead transform our existing courses into simply another hoop students feel they need to jump through, another opportunity to quickly copy homework right before the bell, another course students sigh on their way to?

CS soap opera for girls?

2010 October 3
by Hélène Martin

One of the reasons (of many) that I teach high school is that it’s the best way I’ve come up with to increase women’s access to and interest in computing.  It’s in large part a very selfish battle — I’ve had precious few female friends and colleagues to share my technical interests and passions with and want to see that change for all of us.  It may seem incredible, but I now interact with many more women excited about computing and truly talented in it than I ever have.  Better yet, I have the opportunity to encourage and guide them in developing their technical passions.

The girls I work with are remarkable.  They win programming competitions, have technical internships, take additional computing courses and are generally amazing contributors to my programming courses.  All that in addition to having tons of friends, playing music, participating in competitive sports, taking advanced courses and being amazing human beings.  What more can I ask for?  That they make computing an important part of their futures and join the ranks of passionate technical women.  So far so good — several are expressing interest in that path and I am thrilled to be hearing now and then from those already taking advanced CS courses in college.

They’re in no way exceptional because of their gender.  They’re exceptional because the work they produce and their mindsets are exceptional, period.  A lot of my male students are just as exceptional and I am just as excited about seeing and celebrating what they do.  Few things have irritated me more as I’ve developed my own technical interests as a highlight of my gender.  Yes, I’m a girl, and I’m glad you want to celebrate me for that, but I wish you would criticize me for this incredibly horrible hack I’ve produced or celebrate me for this nifty thing I’ve built instead.  I’ve always felt a shadow on my accomplishments — would the same work have been applauded if I were male?  Am I being encouraged to pursue this field just to contribute to nice statistics?  Would I be sacrificing a lucrative and intellectually-stimulating technical career to teach if these shadows weren’t there?

I continue to have mixed feelings about girls-only initiatives for increasing participation in computer science.  When I was in college, I participated actively in our ACM chapter but didn’t feel as drawn to ACM-W because I wanted to be part of the mainstream.  I worry that women-only events expend women’s energy that could otherwise be used to gain visibility in the broader field.  I know the argument is that by providing ‘safe’ environments for women to discuss their shared experience, they can then have more strength to tackle being a minority but I’m somewhat skeptical.  How can we contribute to changing the dominant culture if we create an insular sub-culture within it?

I’m torn, though.  For example, I think women’s events like Grace Hopper (ongoing as I write this) can be terrifically empowering.  I attended some of the technical sessions last year and was so inspired to see the depth of knowledge many women had.  That really helps provide hope that women can be just as successful as men are in technological fields and cuts through some of at least my doubts and concerns.  Women share information in a different way than men do and I find technical conversations with technical women really satisfying.

My vision for increasing women’s participation in computer science involves exposing girls to intellectually stimulating, meaningful applications of CS.  To me, that’s programming-based, though I know there’s a ton of debate about that.  In my experience, young women with strong math and science skills come into programming courses without many expectations but come out feeling empowered and proud of their accomplishments.  We enjoy doing things we’re good at so convincing girls that they’re technically successful in an authentic way is critically important.  Just telling someone that they could be good at something isn’t enough — we need evidence built up over the course of several projects and challenges.

Of course, that approach is time consuming and tremendously difficult.  It’s not sexy at all or something a funder can just float in, fix, get good PR for and run away.  It requires resolving much deeper issues from how to train successful K-12 high school instructors, figuring out where CS fits into K-12 curriculum, setting up more computer labs in schools, etc.

Instead, we get interventions like the recently-launched DotDiva program which provides web resources for learning about computing, seems to be putting on some pretty nifty events and is apparently putting up a soap opera about women in CS.  I really like the web resources and the launch event schedule made it seem fast-paced and motivating for teenage girls.  I wonder about the effectiveness of these one-day kind of events, though.  I was recently talking to a friend of mine who remembered going to several engineering and computing recruiting events in high school.  Despite all those, she said she couldn’t imagine what the work would actually entail or whether she’d enjoy it.  She never got a chance to get her hands dirty and to decide whether it was for her so she ended up down a very different path.

The soap opera really makes me cringe.  Luckily, I seem to be a minority as there seems to be quite a bit of enthusiasm about it on the web.  I just feel so embarrassed to have technical women portrayed as painting their nails in the office, having totally dysfunctional relationships, stabbing each other in the back, etc.  Is the goal to show girls that even if they have problems in their lives they can become computer scientists?  I don’t understand and hope someone can explain.  I can’t imagine the girls I’m working with would find this appealing at all and I would frankly be embarrassed if they came across it.

I’m certainly glad to see various groups (NCWIT, the Anita Borg Institute, ACM-W, NSF’s BPC, WISE, etc) trying ways to attract young women to computing and I suppose time will inform us of their success.  I know it’s not very glamorous, but I do hope we’ll see more initiatives to support K-12 computer science instructors in their (perhaps mundane) day to day activities like UW computer science is doing for me and Barb Ericson from Georgia Tech has been doing at surprising scale in Georgia.  I think that has more impact potential than parachuting in glitzy, short-term band-aids.

WordPress plugins

2010 September 18
tags:
by Hélène Martin

I’ve gotten some questions about some of the extras I use on the Garfield CS website.  My favorite thing about WordPress is the abundance of great plugins to do just about anything imaginable.  I try to use those as much as possible and include a hack of my own here and there.

Blog in Blog
Blog in blog lets me aggregate all posts for each course separately.  For example, I have a page for all posts for my advanced AP CS course.  I think the only change I’ve made here is to take out the author avatar by modifying the template since I thought that was a little weird.

Countdown Timer
I use this to display the number of days to the AP test.

Featured Posts With Thumbnails
Used to highlight student successes.  I get a little ‘featured post’ dropdown when editing and creating a post to manage this easily.

Google Syntax Highlighter
Used here and there when I show code samples in class notes.

PJW Mime Config
By default, file types like .py or .rkt are not allowed to be uploaded.  This plugin gives a simple UI for adding mime-types supported by the uploader.

Stray Random Quotes
I display a CS-related quote randomly chosen on every refresh of the advanced AP CS course page.  It’s usually used in widget form but instead I use the shortcode to make it part of the page.

Text Replace
This plugin is really useful for annoying text that needs to be used all the time.  For example, the little thumbnails I use in all the course calendars to indicate file type are inserted by replace rules like the following:

:java: => <img src="http://www.garfieldcs.com/wp-content/uploads/2009/08/page_java.gif" alt="Java File" title="java16x16" />

I added the following filter in the register_filters function so it would work with WP-Table Reloaded, too:

add_filter( 'wp_table_reloaded_post_output_table', array( &$this, 'text_replace' ), 11);

Twitter for WordPress
Self-explanatory.  It’s the best Twitter widget I’ve found.   I like using the Twitter feed for interesting things I come across and want to share with students.

User Permissions
Let’s me set per-post permissions so I can have students participate in the website.

WP-dtree
I wasn’t sure how to keep access to materials from previous years and semesters without having a crazy-crowded menu.  This dynamic navigation tree does the trick pretty well, I think.

WP-postratings
Not quite sure how this is going to play out, yet.  Students can rate activities and information I put up.

WP-Table Reloaded
Possibly the most useful plugin for me.  I don’t manage the tables I use for course calendars by hand but instead use the UI this plugin provides.  It saves me some headaches.

Was I Better Today Than I Was Yesterday?

2010 September 16
by Hélène Martin

The recent start of school has had me thinking about what motivates us to perform our best.  I’ve been pondering about it in two contexts — obviously in how to help my students achieve but also in considering my motivators as an instructor and processing recent conversations about teacher evaluation reform.  As luck would have it, Russ Roberts of EconTalk recently released a podcast conversation with Dan Pink about drive, motivation and incentives.

Pink’s argument is that autonomy, mastery and a sense of purpose are the strongest motivators for knowledge workers.  I certainly agree that work that encourages self-improvement towards mastery is extremely rewarding.  In fact, a recently published Harvard study found that progress towards a goal was the strongest motivating and mood-elevating factor for workers.  I found this chart pretty interesting:

What happens on a great work day?

From Harvard Business Review

Feeling like progress is being made and mastery is being achieved is important, but only as long as the purpose for that progress and mastery is clear and makes sense.  Knowing what I’m aiming for is extremely important for my job satisfaction.

Autonomy is the one factor I have most difficulty with.  I tend to find complete autonomy anxiety-inducing because it often comes without a clear sense of purpose and makes progress more difficult to achieve.  What I do agree with is that autonomy in work process is very important — as long as I reach the intended purpose and consistently make progress, I should have some control over how I get there.  To me, a sense of control and predictability are what really matter related to autonomy.  Can I set some of the details of how I reach my goals?  Do I know what reactions and side-effects to expect when I do a certain thing?

In the podcast, management was discussed as a technology used for obtaining compliance in the workplace.  While compliance makes sense in, say, a manufacturing setting, it’s not really the right thing to aim for in jobs where creativity is important.  Instead, Pink argues, engagement is the right thing to aim for.  As students and teachers, aren’t we the ultimate knowledge workers?  Are we being optimally engaged?

Teachers

If autonomy, mastery and a sense of purpose are indeed the most important factors for motivating knowledge workers, then I understand why so many of us teachers have a mixed relationship with our jobs.  Clearly, the sense of purpose is there — is there a more motivating endeavor than to open doors for young people by exposing them to ideas they might not come in contact with otherwise?  Unfortunately, teaching involves participating in an ecosystem plagued by all sorts of strange surprises that have nothing to do with educating kids.

Teacher assessment has recently received significant media attention and I think it’s interesting to think about within this context of motivation.  Naively, I used to think standardized end of course assessments were a great idea and should in fact be motivating to instructors.  Isn’t it a great way to feel like progress is being made and mastery being achieved?  Wouldn’t it give me something concrete to strive for?  The problem is with control, though.  It becomes increasingly evident with each week of teaching that as teachers, we can affect a lot of things, but standardized test scores are a bit of a long shot, especially in high school when study habits are engrained, students have stressors outside the classroom, many are burned out on exams and we have no control over the students who walk in the door.  So instead of being a source of motivation, I can imagine these kinds of exams causing a sense of helplessness, which is not a great way to motivate a work force.  That said, I’m not entirely satisfied with my current sense of purpose.  What are my goals?  How do I know I’m making progress?  What does success look like?

Similarly, scripted or heavily guided curriculum has become a point of contention in my district and others nearby and I struggle with how that fits in with this model of motivation.  On one hand, having a strict curriculum can help give a sense of clear purpose but on the other, autonomy takes a huge hit.  I personally have felt very grateful for the freedom I have in shaping the computer science courses I teach but really, I’m happiest teaching the courses for which I do have highly-structured, near-scripted curriculum.  AP computer science is a very satisfying course for me in large part because I’ve seen a great model for how to teach it and can reuse existing materials.  I can focus on my delivery and on supporting students with the problems they face knowing that the material I’m teaching has worked for thousands of students at the University of Washington.  I also have a clear goal: preparing students for the AP exam and for a second semester college computer science course.  Is prescribing curriculum such a bad thing or is the fact that I chose the model I’m following rather than having it be imposed an important factor in my motivation?

The podcast also discussed financial motivators and one thing really stood out to me: research has shown that bonuses, if they’re too small, can in fact act as de-motivators.  I had the opportunity to experience this first-hand when my district recently proposed an incentive program that would have given me all of $400 extra per year for enrollment in a complex evaluation program.  For the sacrifices they were asking for, the thought of such small pay was depressing — I’ve made that in a day as a consultant.  I think teachers in general are not terribly motivated by money so to offer a ceremonial amount is a total turn-off.  Instead, offer us more collaboration time, a lighter course load or a longer lunch break!  It was a relief when that proposal was taken off the table.

Ultimately, I think what really takes a toll on a lot of us is the sense of lack of control and frequent unpredictability.  Will I have a computer account for the first month of school?  Will a meeting be spontaneously scheduled tomorrow when I set a medical appointment?  Will the bell scheduled be changed with a day of notice?  Will a student with no background or severe learning disabilities be placed in my advanced class?  Will I have to go two months without pay as HR scrambles to register new employees?  Will my administrator come in for one of two yearly evaluations during a chaotic day?  Will one of my students have a horrible experience at home and throw off the class atmosphere?  Will my teaching assignment be changed three days before the start of school?  Will the school be out of paper for weeks on end?  Will I ever get funding for X, Y and Z?  We just don’t know, we know it affects our students’ learning, but there’s nothing we can do about it.  How can we possibly be motivated to do our best when all kinds of things beyond our control keep on happening?

Recently, Scott McLeod, a professor of educational administration and thought-provoking blogger, had a series of guest posts on what teachers need from their administrators.  My answer: predictability.

Students

In my book, students are the ultimate knowledge workers and I’m convinced autonomy, mastery and a sense of purpose are in fact important for them as well.  When I’m in the position of being a student, I know that mastery is what most motivates me and that conversely I’m most frustrated when I have to do busy work or just don’t feel like I’m making progress.  True learning is clearly something we’re wired to enjoy!  When I look at my students who ‘don’t like school’ or ‘don’t do school,’ more often than not it has more to do with the fact that they’re not learning.  In some cases it’s because they’re just so behind that they can’t keep up but just as often it’s that they’re too advanced for the course work.  I believe in the zone of proximal development but is it realistic to expect that 30 developmentally different brains would be operating in that sweet spot with only one instructor to mediate?  I know there are some students I’m not serving well but I just don’t have the time or energy to prepare entirely different course work for them and that’s a serious source of frustration for both sides.  I suspect the large part of the key to a motivated student is a motivated teacher.

What about a sense of purpose?  It seems important that students feel like the coursework they are doing is helping them achieve their goals.  But what’s the best way of achieving that?  Does every problem have to be tied directly to interesting problems in every day life?  My sense here is that it’s helpful AS LONG AS IT DOESN’T AFFECT MASTERY which would reduce motivation.  I teach programming in a very structured way and though no one has said it to my face, I’m sure some would call it creativity-stifling.  I do it like this because I find more students are likely to achieve mastery of the concepts and to reach a state where they can be creative that way.  I compensate by being deliberate about giving examples of how the skills learned will be useful and about getting students excited about the broader computer science field.  Do I give my students enough of a sense of purpose?

I think having autonomy in that list may help explain why we have been on a continual path towards discovery learning and away from direct instruction.  Culturally we really value feeling control over what we do and I think that makes sense.  I think there are different levels of control, though.  Clearly, students need guidance to make progress towards mastery so complete autonomy for any but the most intrinsically motivated can be pretty disastrous in terms of motivation as well as learning outcomes.  My experience suggests that clear guidelines and predictable expectations and grading are strong motivators for students.  But how can I grade consistently when I do it after 8pm when I’m finally done preparing for the next day?

And in conclusion

Ah, motivation.  Having it is the most amazing high possible and lacking it can completely undermine any endeavor.  I found Pink’s characterization of what elicits it pretty useful for reasoning about my own experience.  I think morale in public education is pretty low these days with budget cuts, rampant corruption, ineffective staff, burned out students… can we bring back some control, mastery and sense of purpose?

High School Computer Science Belongs on the Web

2010 August 31
by Hélène Martin

I spent a good chunk of time this summer working on my high school computer science program’s website. I did it partly because I love tinkering with web stuff, partly to work on WordPress skills going but mostly because I think it’s critical to my teaching practice.

Ordering my goals for the site helped me figure out how to organize things.  Here’s what I came up with:

  1. Provide access to learning materials and assignments to current students (replace textbooks)
  2. Empower students to interact with the content and each other
  3. Allow parents to easily monitor their students’ learning and deadlines
  4. Highlight student successes
  5. Advertise to prospective students
  6. Communicate with Seattle’s computing community
  7. Provide access to materials for other teachers to use

When I visited schools in the area before committing to teaching, I was appalled to see a lot of old textbooks.  Sadly, public school budgets tend to only allow for new books every five to ten years which in a changing field like computer science is not always appropriate.  I decided that my courses would have to operate without conventional textbooks so that I wouldn’t feel chained to obsolete materials.  This makes a lot of teachers look at me as though I were crazy, but I find it freeing.  There are several free textbooks I pull readings from but mostly I rely on content made available by college computer science instructors.  I mix and match to meet the needs and interests of my students and they know to always look at the online calendar for their class to find out what we’re doing.

The biggest changes I made in the site’s organization involved making advertising more upfront.  I hope it can now serve as a communication tool with prospective students and the Seattle-area computing community.  I’m particularly happy with the ‘beyond the classroom‘ section which will allow me to highlight interesting internships, college classes, competitions, etc students are involved in.

Overall, students have responded very positively to having a mostly paper-free experience in my classes (I surveyed them about it).  As computer science instructors, I feel we have a responsibility to model effective leveraging of computing tools.  What better way than by establishing a web presence for our programs?

Why Build Your Own Blocks?

2010 August 19
by Hélène Martin

The Scratch interface.

Scratch provides a drag-and-drop environment for experimenting with programming and building sophisticated interactive artifacts.  Programming constructs are represented as blocks that can be dragged onto a scripts area to control the behavior of particular objects on the “stage.”  Scratch provides all the common constructs from imperative languages — definite loops, indefinite loops, conditionals, variables, etc.  It also provides a nice model for concurrency and message passing which are traditionally considered advanced topics partly because of prohibitively complex syntax but of course also because getting it just right is truly difficult.  Lots of niceties are included like ways of accessing mouse and keyboard events or producing sounds.

A big complaint about Scratch has been the absence of means of abstraction: message passing is the best way to get something subroutine-like and the world objects are independent instances with no way of capturing commonality.  In other words, there are no functions and there are no classes.

This lack of means of abstraction is a mixed blessing.  On one hand, if we consider one of the major concerns of computer science to be managing complexity, then the Scratch model really fails to provide exposure to a huge chunk of the field.  On the other, what we have now is an environment in which children and adults who retain a sense of childlike wonder truly can be expected to discover and create entirely on their own.  There are no hidden menus and nothing that really behaves any way other than what would be expected. That, to me, is very exciting, because it allows me to get my rambunctious 9th graders problem solving right away.

Now, thanks to Smalltalk programmer extraordinaire Jens Mönig and the vision of Brian Harvey from Berkeley, there does exist a version of Scratch with means of abstraction and it’s called BYOB.  I don’t know whether this is a measure of the excitement for the project or just of how much the WWW is still run by computer scientists but it currently comes out as result 6 for the search term ‘BYOB’ on Google, before songs and allusions to tasty beverages.  There also exist a pretty nice Scratch wiki page and a manual.

(I should note that lots of people will point to Alice as an example of a drag-and-drop programming interface that has always included abstraction through classes and methods.  I think there’s a lot in Alice that detracts from the problem solving experience including 3D reasoning, too much focus on animation details and lots and lots of bugs.  I’m also not a fan of teaching OOP early.  Basically, I don’t like it so I won’t say any more about it, but it’s worth checking out.  Similarly, Squeak is Scratch’s more powerful but less intuitive parent.  There are also several other Scratch spinoffs that offer some of the same functionality and more.)

BYOB brings higher-order functions, nested lists, recursion, type checking, nested sprites, a basic OOP model and other goodies to the Scratch world.  Clearly, BYOB is an extremely powerful tool that gives a better sense of what computing can achieve.  That said, I don’t think I’m going to use it for teaching.

I’m very excited about abstraction.  I find it thrilling to think that a bunch of ever-richer abstraction layers have gotten us from bursts of electrical current to Facebook and self-checkout machines at grocery stores.  I want to share that excitement and that sense of infinite possibilities with my students as much as possible.  I’m also a pragmatist (or is it a defeatist?) — I understand that many of my students have never been taught to think abstractly and are very limited in that domain.

What I think is fantastic about Scratch is that it provides a context in which programming is concrete.  We can focus on expressing ideas precisely and ordering their substeps which students in my intro class also often have very little experience with.  The results are immediate: a cat draws a square, the background flashes, etc.  That’s a skill set that will be useful to students no matter what they end up doing with their lives.  Sure, they don’t immediately dive into the big ideas of computer science, but they make significant steps in that direction.  I find it exciting when they discover limitations of Scratch and complain about them (“Ms. Maaartin, why can’t I just make lots and lots of cats from one blueprint?!”) because I find it a nice segue to more traditional programming languages.  BYOB ups the ceiling on what can be expressed but I feel that once one has a deep enough understanding to want things like anonymous functions and have a true need for them, a drag and drop interface gets in the way more than anything.

Creating an input to a custom block.

I found the interface for creating a custom block pleasantly straight-forward — someone has clearly spent a lot of time thinking about how to make a really quite complex idea relatively easy to work with graphically.

In this example, I chose to create a reporter block named ‘double’ and then hovered my mouse over it to get the option to add an input.  I clicked on the orange ‘+’ on the right and got the dialog box titled ‘?.’  By default, the dark gray advanced options are collapsed and the input is untyped.  When the dark gray box is opened, I can choose a type for the input and control its scope.  Again, lots of power here, but also a lot of need for instruction to get anywhere near being able to use it effectively and deliberately.

I was creating this very simple procedure so I could double the contents of a list.  Map is a custom reporter and it takes a function and a list (in this case an anonymous one) as parameters.  What the heck is a reporter and how is it different from a command?  Maybe my initial confusion shows my lack of education and I haven’t yet dug too deeply into exactly what’s going on, but it looks like a reporter is a first class procedure that returns (“reports”) something and so it’s treated as a value to be used as part of expressions.  That’s in contrast with a command which is directly executed and can’t be used as part of an expression.  What’s interesting is that a difference is made between ‘reporters’ and ‘predicates’ — procedures that return booleans but there’s no differentiation between integer, string or list reporters.  Not sure what the ramifications of that are.

Clearly, there’s an elegance to what’s going on here, but my wrist really hurts from clicking everywhere.  Part of it is that I’m learning as I go, but even doing all this as efficiently as possible requires lots of digging around in menus and clicking and dragging.  Of course, I may be biased because I tend to like tools that let me use the keyboard — command line, Emacs, LaTeX — they may be slower for basic, novice use, but they’re much faster for complex applications by power users.  I guess I kind of see most of programming as a power user type of action.  Scratch managed to provide a limited enough subset of programming that I could see it as a nice novice tool but now BYOB is going into a territory I’m less comfortable with.

BYOB takes a lot from languages like Scheme which are celebrated as teaching languages because their core is small but expressive.  BYOB may still have a small core, but with it comes the need to understand and use lots of different kinds of dialog boxes and menus and radio buttons.  With BYOB, it’s not just a matter of learning the syntax for a define statement, it’s a matter of knowing and understanding all of the clicks and decisions needed to create a procedure.  And there are a lot.

I feel like students who really understand the ramifications of means of abstraction will also understand that typing keywords can often be more efficient than using GUIs.  On the flip side, I suspect that students who just see a lot of pretty colorful icons and are excited to make things move around on the screen will miss the implications of many of the deeper concepts BYOB tries to convey and are likely to get confused and frustrated by all the clicking and menus.  To me, some of the million dollar questions are

  • whether students get more excited about the pretty Scratch animations or by the pretty pictures generated through, say, the Racket “world” Teachpack which lets students create visual programs using function composition in a variant of Scheme,
  • whether the knowledge students acquire through using a drag-and-drop interface like BYOB transfers to more typical languages,
  • which of having to click around a whole bunch and having to memorize syntax and worry about parentheses or white space is less frustrating for novices.

It’s not clear that these can really be separated out and studied in any reasonable way or that anyone would be interested in doing such analysis without devolving into rants about when recursion should be taught but a girl can hope…

I’m curious to see more examples of BYOB used for instruction.  Dan Garcia and Brian Harvey have been using it to revamp Berkeley’s non-majors intro to computer science course and are calling their offering the Beauty and Joy of Computing.  This fall’s class is one of the 5 pilots for the proposed new AP Computer Science: Principles course.  I’ve heard of Josh Paley, great instructor from my former high school, using it with middle schoolers.  What else is out there?  What niche does it fill?

TeachScheme teaches principles. What do the rest of us teach?

2010 August 12
by Hélène Martin

Bottom line: I challenge anyone who takes an objects-first approach to teaching introductory programming to provide an account of the order in which concepts are introduced tied to the CS principles they illustrate and to articulate reasons for their ordering based on cognitive load for the students (a paper reference will do, too).

I recently spent a deeply engaging and thought-provoking week learning about the TeachScheme curriculum with Kathi Fisler from Worcester Polytechnic Institute and Shriram Krishnamurthi from Brown.  Both have worked with the curriculum since its inception at Rice around 15 years ago.  During that decade and a half, they have contributed to incremental refinements and seen it taught at hundreds of high schools and colleges. My initial thoughts on the workshop can be read here; I’ve now been reflecting on the material for a few weeks and offer some higher level thoughts.

What’s your course’s underlying philosophy?

The authors of the TeachScheme curriculum note that “college is the only time in a programmer’s life when he is exposed to principled ideas on a regular and rigorous basis” [1].  Unlike most approaches to teaching introductory programming, which can be labeled as ad-hoc at best, TeachScheme is based on several ideas woven through all aspects of the highly-structured curriculum:

  • Use of design recipes as a way to systematize the programming process and provide students with a starting point
  • Testing as an integral part of programming
  • Introduction of syntax only as needed to illustrate broader principles
  • Use of an environment which provides error messages appropriate for a learner’s level

While these underlying ideas may seem fairly simple and language-agnostic, I think it quickly becomes obvious that they are not frequently followed in CS1 courses and more subtly, that many modern languages actually guide instructors away from them.

Take the focus on testing, for example.  A Java instructor might say “Aha, I’ll just introduce JUnit early.”  Unfortunately, understanding JUnit requires a lot of background knowledge on things like inheritance, static methods, reflection… sure, one could probably use it just fine by pattern matching, but I think that process takes away from the simple goal: figure out whether an algorithm does what it’s supposed to.  For a beginner, the challenge in testing should be figuring out appropriate test cases, not expressing them.  Worse even is that much of Java code, whether it’s object-oriented or not, includes changing variables and various kinds of output.  These make verifying whether a certain piece of code works as intended potentially quite difficult.

What about introducing syntax in a measured, systematic way?  That’s something I strongly value because I think students with lower computing self-esteem (girls and ethnic minorities) are particularly hard-hit by syntactic ambiguity.  A lot of my hot-headed boys will play around until they figure out how a particular construct works and not be phased if it doesn’t match their initial expectations but I’ve seen many girls think they were dumb simply because I hadn’t properly explained all the possible errors they might encounter in using a new syntactic element.

Most advocates of languages other than Java pounce on “public-static-void-main-string-bracket-bracket-args” as a prohibitively convoluted way of starting a program.  In practice, though it’s irritating and I hate having to introduce it without being able to give much explanation initially, I don’t find that particularly alarming for students — I have them learn it as an incantation and/or copy it and eventually they do understand all parts.  That said, I think the incantation is symptomatic of a broader problem of dependency: lots of constructs in imperative languages are interconnected.  For example, to have any hope of using an iterative construct (while or for loop), a student is going to need to understand the syntax for variable assignment and mutation (storing a value in a variable and changing it).  Even worse, to reliably use variables, a student will need to understand things about memory.  So many levels of knowledge and understanding are required that we can’t get to solving problems — we’re stuck with syntax and semantics.  Python, PHP, C and your favorite obscure imperative language all include these challenges.

Racket: a Scheme variant

As I mentioned in my last post on the workshop, the ideas which have guided the creation and refinement of the TeachScheme curriculum really resonate with me.  In fact, there’s a lot of overlap with the principles that guide my own instruction but I’m all too aware that I constantly make significant compromises.  For example, I don’t have students use formal testing methodology but I have them diff their output (both text and graphical) to expected output.  That’s certainly not as systematic or scalable as I would like.  Another example of a compromise is the previously-mentioned main method header — I accept that I’ll explain it throughout the semester but I still grind my teeth a little at night because of its initial lack of clarity.  My practice is peppered with these uneasy compromises primarily dictated by the fact that I teach procedural languages.

In contrast, the originators of TeachScheme have been unwilling to compromise on the underlying principles.  They are able to do this by using Racket, a variant of Scheme.  The language has been modified to reflect the needs of the curriculum.  For example, it has a check-expect function which can be used inline with other Racket code to compare the result of two expressions:

Dr. Racket check-expect

This makes testing functions simple and systematic.  I think the fact that the language and environment support this style of testing allows some great early conversation on a fundamental principle of computer science: algorithm correctness.

I’ve also attempted to use this trivial example to illustrate the design process emphasized by How to Design Programs, the free textbook that uses the TeachScheme philosophy.  Most approaches to teaching programming rely on showing lots of examples for students to learn from.  TeachScheme is based on the notion that ” implicit learning does not work well for the majority of students. Most students are not the type of learner who can extract abstract principles on program design from a series of examples” [1].  Instead, we should explicitly describe the process of going from a problem statement to a program.  In the example above, I’ve got a comment at the top that includes the types of inputs and outputs (the contract) as well as a short purpose statement.  Writing those comments and the tests were part of the design process.  Of course, this becomes much more meaningful when operating on more complex data such as lists of CDs:

Racket design process

I think the first thing to notice is that a complex data type is defined concisely using a struct at the very top.  There’s no need for a constructor or default values as would be the case if writing a corresponding class.  This enables the discussion of representing and manipulating fairly complex data without getting bogged down in syntax and concepts like mutation.

The three comments following the struct definition certainly look a little odd but they have their reason.  The first block is a “template” for writing a function that processes a CD.  This is an example of a technique used to reduce the “blank page anxiety.”  If a student writes this template, they can see that the only things that can possibly be done by a function that operates on a CD are manipulating its title, its count or its category.

The second comment block defines what a list of CDs is.  Again, kind of weird for those not used to functional programming, but it has its elegance.  There’s no need to define a new data type for a list of CDs, hence the comment status.  The cons function is used to build linked lists “on the fly.”  The comment is again used to reduce “blank page anxiety” and guide students who are getting lost.

The third comment block defines a template for what a function that consumes a list of CDs should look like.  Unsurprisingly, my total-stock function looks awfully similar to it.

I also wrote some sample data as well as a check-expect BEFORE writing the total-stock function.  With the framework in place, writing the function is very simple and verifying its validity is even simpler.  This may seem like a lot of work for a three-line function but it pays off as examples get more and more complex.  For example, take a look at a filesystem assignment.  I attempted it in an ad hoc manner and got bogged down in all the mutually recursive data definitions.  With the templates, I was done in no time.

Why isn’t it more popular?

Principles may be front and center, but TeachScheme is not a fashionable approach.  First of all, the functional programming paradigm is not very common.  A quick glance at the charts on langpop.com shows imperative and OO languages like Java, C, C++, PHP, etc at the top and functional languages like Lisp, Scheme, Haskell, etc, pretty low on the ladder.  That can be discouraging for students who hope to immediately be able to get an internship or write something that looks like a Windows native application.

Secondly, the signal to noise ratio in functional programming is very high.  In other words, programs are generally quite short, but every line requires deliberate thought.  I think that makes a lot of people shy away from it and treat it as harder than imperative programming.  Related to that, there’s a kind of inertia: if instructors learned procedural or OO languages first, it’s only natural that we’d be uncomfortable reaching out of our expertise, especially to something we have considered harder.  I think the sacrifice here is that although functional programming leverages existing math knowledge, algebra is already quite hard for a lot of people, thus not easily available for transfer.  I also think most people consider software in terms of what it does rather than what it computes and that lends itself better to imperative programming — do this, then change that, then call that routine, etc.

Unfortunately, I suspect the real reason TeachScheme isn’t more prominent has more to do with egos than with technical merit.

Scorn is not a good advertising tactic

Before going to this excellent workshop, I had heard of TeachScheme but generally not in a very positive light.  One of the other workshop participants summed it up in a way I really liked — “scorn is not a good advertising tactic.”  First of all, most of the functional programmers I’ve known, from high school and beyond, have been incredibly brilliant and unwilling to suffer fools, otherwise known as people-who-program-in-PHP-omg-that’s-a-disgusting-language — people like me.  As a result, I was, as many people are, mostly intimidated by functional languages.

Then, there is an aura of religious zealotry and inflexibility around the TeachScheme materials.  I think a lot of people feel threatened by the vague “if you don’t think this is the right way to teach intro CS you are dumb” vibes exuded by the project.  I don’t know quite where those come from, but I don’t think I’m the only one who has felt them.

My next steps

I’m going to be using the TeachScheme curriculum in the fall with my advanced AP class composed of students with some prior programming experience.  I think they’re a good group to focus on principles with because they have enough background to grasp the implications of these principles.

I’m a little more willing to compromise, though, and I’m not ready to make a complete switch.  That said, I think I can be more deliberate about using a lot of the principled ideas in my procedural to OO classes in Java and Python.  It’s also become even more clear to me that starting with objects first is not of interest to me — I think the sacrifices are too great.

Above all, I’m going to continue my search for a single other coherent approach to teaching introductory programming which has gone through such methodical review.  I’m disappointed not to have found any; pointers would be appreciated.

  1. M. Felleisen, R. Findler, M. Flatt, and S. Krishnamurthi, "The structure and interpretation of the computer science curriculum," Journal of Functional Programming, vol. 14, iss. 04, pp. 365-378, 2004.