Just moozing

Before you can check your notes, you must make them…

Teaching python

leave a comment »

We have decided to teach the students Python. Since the topic of which programming language is the better one, I would like to shared my thoughts on why we chose it.

I will also discuss our thoughts on why unit testing might be a very good idea for teaching programming.

Choosing Python

The students will have one course in one semester to learn the basics. We will then assume that they know enough to handle minor programming problems in later courses. This puts an emphasis on the language being “easy” to learn for beginners. That rules out (the very potent) Perl and its steep learning curve.

It is a class directed towards networking, not programming. In our discussions, we concluded that they needed to know a scripting language. That rules out Java, C, C++ and other languages that are to be compiled and linked.

In my opinion, we could justify using C# or some other .NET language, since they are highly focused on RAD and Microsoft has free development tools for download. Other schools use .NET, so it is a viable option. But, admittedly, we are biased towards Linux, and .NET with mono on Linux did not seem like the logical choice.

Pure scripting in Bash is also an option, but Bash syntax has always been beyond me. Microsoft has powershell, which I don’t know anything about, except that it should be very useful for scripting windows servers, and, again, it is pure Microsoft.

In favor of Python is the fact that it is widely used. This has two very big advantages: 1) you may find Python libraries for almost anything and 2) there are a lot of Python resources on the internet. On top of that, you have the discussion of what is the easiest language (example from 2006). It is a religious discussion, but Python is definitely among the easy ones.

Teaching vs. learning Python

I have learned Python. It included setting some programming goal, going through a lot of documentation form python.org and dive into python. It was fairly easy, I have done it before with vb.NET, Perl, Php and C++. So I know what to expect in terms of programming concepts and capabilities.

As an example; issues with strings, programmers just know that there is a way of getting the 7th character. It is just a matter of googling the right keyword. Newcomers to programming do not know such things. Even worse, fundamental constructs like loops and branching are abstract stuff, that does not come naturally.

The standard way of teaching a programming language is to take the different language constructs one-by-one, and discuss the theory and going some exercises. The easiest way of handling that for the teacher is to find a book that some has written, and go through the chapters. We have tried that. Some students were lost, some where doing exercises without learning, and then there were the motivated students who actually learned something. The skill range from top to bottom was enormous. What to do?

It all comes down to motivation. If the students are motivated, anything is possible. So, how to motivate the students?

We have decided on an experiment using unit testing. As always, the language constructs will be divided onto lessons and exercises related to the construct of the day will be given. The difference is that we will try to tap into the positive reinforcement that happens when it works. All programmers know the cool feeling of pressing the ‘run’ button and it just works.

An exercise could be modifying an existing function to take a parameter. At first the unit test fails, or, as in this case, we have a syntax error. Then adding the parameter and running the unit test again will yield a success.  As an extra pad on the back, they get to do an SVN commit describing the success.

From a pedagogical point of view this should work. And, as a bonus, they learn the basics of unit testing and version control. Also, the teachers will have an easy time looking over the commits to check progress.

For this to succeed, we (the teachers) have to be well prepared. The programming environment with Python, unit testing and SVN must work. We need easy commit scripts and servers that just work. In order to handle the part about the PC that the students use, we are looking into drbl (as mentioned in an earlier post). That should allow us to lock down the system enough to make sure that all the student PCs work with the correct software (and correct versions).

I have searched for others doing this, and I have not found it. There are a lot of resources describing how to learn unit testing, but none related to teaching using unit testing. Perhaps we are on uncharted territory, or they is a really obvious flaw in our reasoning. We will see.

Advertisements

Written by moozing

June 28, 2010 at 09:00

Posted in Teaching, Tech

Tagged with , ,

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

%d bloggers like this: