Friday, August 24, 2007

thoughts on a python programming competition

NCSS Challenge: The National Computer Science School python programming competition run by the School of Information Technologies, at the University of Sydney

I'm on long service leave, so I had time to participate in this competition, since they encourage teacher participation. NB. I would not have had time for it - no way - if I had been teaching.

I was very rusty on my python programming. Having the intensity of a competition with strict deadlines (complete 5 challenges a week for 5 weeks) provided some clear structure and pressure to get on with it

My general view about programming is that it is hard to learn. I'm also quite keen to improve my skill because for me programming has a deep sense of epistemological importance wrt to future of the human race. Two links and one quote about this. Why program? What is programming?
(Abelson and Sussman)....writing a computer program is really about the intellectually difficult task of how to control a complex system. The programming language provides us with a means to express and explore ideas about this which would otherwise be too complex to manage.
Each participant is given a profile page where, inter alia, they can enter their code into a window. A server runs some tests on the code which then provides feedback and whether your code was successful or not. You have 5 tries before you lose any points, which is a necessary feature for a machine check. Although far from perfect this mechanism does mean that the organisers do not become snowed under with marking. The negative is that it also limits the creativity or individuality of the competition, unlike some Game Maker competitions I have recently been involved with.

Forums are also provided. One of the forums allows participants to put in a query for code they think should work but which doesn't. I used this a few times. Then a real person evaluates your code and gives you some feedback.

So, there is a combination of machine checking and human checking which minimises work load for the organisers but provides necessary human to human feedback for those who are puzzled with a hard problem. The testing process meant that you had to finish off your program completely to pass all the tests. If you didn't then you received zero points

In the main this feedback mechanism worked well for me. ie. normally the feedback (either machine or human) made sense and I could then proceed to improve my code. Sometimes I thought the tests were either mean (not explained in the challenge) or trivial (eg. "!" missing in a print statement) but the 5 point buffer made up for that.

It was a competition. There was scoring with points, a leader board was published etc. Overall, I found this provided focus and was motivating. However, when I couldn't solve the spreadsheet problem fully after 4 days it made me dispirited for a while. So it could be hard for those struggling with the basics more than me.

The challenges varied in difficulty from easy to hard (my opinion). Examples of hard problems included a spreadsheet simulation (I learnt about eval in doing this one, but still didn't manage to meet all the criteria in time) and programming a MUD.

The challenges focused pretty much on the maths and logic domain. My logical thinking mechanisms have been give a good workout! The sort of things covered required me to improve my skills in the use of strings, lists, dictionaries, conditionals and importing and reading files. For example, one of the problems involved reading in an English to German dictionary (provided) and programming some translations of nouns from English to German and back again. Other problems involved sequences, working out what the sequence was and then writing a program to provide the correct output for an input sequence number.

So, my criticism here is that this is reinforcing an already stereotyped pool of recruits into programming, those who are already good at maths and logic. I think more than this will be required to reverse the trend of declining IT enrollments to courses. Read Mark Guzdial's post, The Wonderful Opportunities of the Declining Enrollment Crisis

Briefly, here are some of the things I learnt or beliefs which were reinforced from the programming part of the competition:
  • computer programming is not easy (I've already said that)
  • you need to put in the hours
  • it's necessary to have some large slabs of uninterrupted time, the very thing that nearly all teachers do not have
  • sometimes logic errors totally confound me, initially, I just cannot see how the error message I am receiving, either from python traceback, or, from the competition automatic tests, could possibly be correct
  • but then it's either terribly frustrating or wonderfully elating when some time later your next effort either succeeds or fails
  • surely I'm not the only programmer who experiences despair and / or elation
  • more than once I did not read the question thoroughly enough and this led to errors which could have been avoided - pretty funny since I'm a teacher who sometimes tell students to read the question carefully and then become frustrated sometimes when they don't seem to
  • overall the testing process pushed me in the direction of becoming more rigorous and proactive, to think before submitting code - to question some of my "she'll be right, mate" attitudes
  • you need a good reference manual, pp. 49-50 of Python in a Nutshell (list and dictionary methods) has become well worn.
Many thanks to the IT crew at University of Sydney for organising this.

7 comments:

Unknown said...

Hi Bill,

Thanks for your feedback on the NCSS Challenge. I agree that there is a mixture of frustration and elation in the Challenge, which matches my experience of programming in general.

As to the issue of reinforcing stereotypes: our aim in running the Challenge is to have teenagers realise that programming can be an intellectually challenging and rewarding activity (unlike, say, drawing a window with Visual Basic).

Hopefully this will lead some students to consider further study in computing, but we aren't trying to single-handedly turn around a global demise in enrolments in IT courses at university level.

We are also constrained in some ways by our current infrastructure (copying and pasting code into a web browser, automated marking, etc.) but hope to address some of the constraints over time.

Thanks again for your feedback,
Michael Cahill
NCSS Challenge, University of Sydney

lucychili said...

Hi folks
I think the NCSS program is great.

Perhaps the doing it remotely thing is tricky. Perhaps a camp might give people that start time with friends to get over the initial hurdle.

(I am trying to organise something like this for 2008 in Robe SA looking at squeak / python / php depending on interest.

If NCSS would like to have someone come along that would be great.

I think the English language, or any language is complex to understand.
Being able to speak both human and functional code languages give people a much stronger set of tools for understanding the world around them in technology and human terms.

Bill do you feel your blogpost encourages new folks to try? =)
How would you organise a program which made coding really accessible?
What does a simple path into coding look like from a teacher perspective?
There are a few of you who do so perhaps there are some answers there.
What were the first concepts that you found helped you to move on?
Perhaps it is one of those ride a bike things that feels difficult to explain and the structure sticks once you get the hang of it.
Time and the opporunity to have a go with friends feels like it might help?

Bravo to NCSS and to Bill
I think this stuff will become more straightforward when more people have had a go so these opportunities are important.

Chris Betcher said...

Thanks for your insights Bill. I have wanted to learn Python for a while now, but again the time issue always seems to beat me. Programming is a bit like playing golf... it's probably not so hard to learn to do it, but it can be a lifelong challenge to learn to do it WELL!

Chris

Wara said...

In response to some of lucychili's statements, I find that students experience the AhHa phenomena phenomena more when we are learning programming than any other skill that I have taught. I often wonder if it is the way that I teach it. It is when undertaking programming challenges that I personally tend to experience the AhHa feeling a lot and we tend to teach the way that we learn ourselves.

As I have become more experienced as a teacher I find it useful to talk about the learning curve story prior to starting programming. It was only a matter of 2 or 3 weeks ago that a student talked to me about how, on that weekend, he had had an epiphany with some Javascript programming. I took him to the chart on the wall, my printout of the learning
curve story
, and asked "Is that what it felt like?". His reaction was very strong and interesting - he basically said "How did you know?"

So it could be "one of those ride a bike things that feels difficult to explain and the structure sticks once you get the hang of it." The skun knees and hands from learning to ride a bike stick well in my memory.

Anonymous said...

Python is brilliant. I enter my senior class in the Challenge each year and I enjoy working with them on it. I believe that SydUni runs a beginners and an advanced course on teaching Python and also has a Summer School for senior students (competitive entry, not just for programming students) where the coding is done in Python with no assumptions about prior experience. I went in the first year as a supervising teacher. It was great!

Bill Kerr said...

lucychilli asked a few questions about ways to facilitate the teaching of programming

I think there are partial answers but no finished answer. A program like Scratch (designed for after school clubhouse with little adult input) for example has taken many years to evolve and the evolution has not finished yet. Some really clever people have worked hard and thought hard about these issues for many years - and we are not there yet.

One guiding principle should probably be "hard fun" - even though I'm not completely happy with that slogan because it does gloss over the very real frustration / elation cycle that I've mentioned.

1) Some things we know - a good visual interface, iconic programming, is essential for first timers, eg. Scratch, Etoys, GameMaker.

Apart from that I can think of two other things that are important:

2) Motivation or engagement, this is a powerful argument for game making which does motivate many students, although mainly boys

3) An understanding of genetic epistemology (internal knowledge development) - what sort of programming constructs are accessible to children at whatever stage they are at?

Some of the recent alan kay posts to the non universals thread of the squeakland list, such as this one, have persuaded me that I need to do some more study of point (3). I plan to post some of this to my blog in the hopefully near future.

I think we need all 3 points above. Otherwise, the 5% of natural born hackers will continue to learn programming but most of the population won't. (perhaps I should write this up with more detail as a separate blog post?)

Unknown said...

Well done NCSS and thanks all for your comments. Lucychilli has me thinking about competitions vs. camps. Competitions are difficult: if we automate the marking, we lose much of the creativity, if we allow wide ranging creativity, the marking is very time consuming.

Why have competitions? they give motivation and allow geographically dispersed bright kids the opportunity to interact with other bright kids. They don't do much for the middle or lower groups.

Camps can be motivating and bring kids together with a common interest. Rather than kids competing, it is easy to set up a sharing 'open source' atmosphere where kids are happy to share and show off their creations.