'Intro to programming' class

Last Monday was session #2 for the Introduction to programming class (with Python!) that I'm teaching in Tog.

The class was starting at 7pm and I freaked out a little when by 7.15 only 2 people from the week before had showed up, plus one brand new student (was I that bad?!) Thankfully people trickled down and although 3 people sent an excuse we had a nice group going by 7.30.

Exercises

I guess here, the fact that I like to start with exercises helped so that even people showing up a bit late wouldn't miss anything important and could simply start on the exercises as they came in. I like to give a few exercises about the concepts previously learnt, the idea being that everyone must solve at least one before we move on to a new concept, and people who finish early can do more of them instead of waiting. I realise it's kind of counter-intuitive to the usual way of teaching with exercises coming at the end instead, but I find it works well (with sessions lasting more than 1 hour in any case). It helps reinforce previously learnt concepts and for the students to refresh their minds. I don't really expect people to find the time to try exercises and practice coding in their own time (yet!) and it certainly didn't work with my high school students. Perhaps next week I will be proven wrong as people were asking for practice exercises as the class ended :)

Pace

We actually only had time to learn one new concept this time, the first loop. It was the same when I taught the teenagers before, and I thought it was because there had been 3 weeks between the first and second session, but we ended up doing roughly as much here. Perhaps my exercises take too long to do, or perhaps I take a while to go through, er, the "while" loop. I'm not too worried about it to be honest. This is the first exposure to many programming concepts, and the exercises using "if" and the rest are the first programs bigger than 3 lines (10 to 25 usually) that the students are writing. Of course it takes time.

A session lasts 2h30 this time. Unlike the kids the adults were not very good at reminding me to take breaks ;) I think after doing the initial exercises we were all eager to move on to learning something new, and then I kinda forgot to take a break. I was wrecked and nearly dizzy by 9.15, I suspect the students kinda felt the same. Must take a break around 8.20 next week. For both my sake and the students'! Perhaps after the exercises and after having a short overview/first taste of a new concept...

Preparing

For preparation, once again I mostly cannibalised and expanded on what I taught the first time :) I also changed the odd exercise, and removed a few references to high school. A new exercise was writing a fake GUI with a couple of options and it ended up being a killer and great fun! (Although the backslashes caused a couple of unfortunate escaping issues, I guess I'll make the character wave the other way around next time, at least!)

 ______________________________________
|                                     |
|         HELLO!                      |
|       /                             |
|    \O         Choose an             |
|     |\             option           |
|    / \                              |
|                                     |
|              a. Say hi              |
|              b. Say goodbye         |
|              c. Fortune cookie      |
|_____________________________________|

I remember last time, I thought I introduced 'random' too late considering how excited the students were after we transformed their program into a real game. Note to self: I think I may have introduced it too early this time! Probably after we add "hints" (too low/too high) to the game would be the best place to bring it up.

The students

Once again people are a lot more active. They ask questions, they describe their understanding until the point they're stuck and then ask for clarifications. If I'm not being clear at explaining something, they let me know. I really enjoy this. They also spontaneously explain things to each other and form groups, then explain to each other, ask and answer questions among themselves, copy and try to modify to understand ;) All of this is also great for me, I listen and learn new, different ways of explaining what I just taught.

Overall, the students look like they're having a lot of fun, and are happy to be learning new things and new ways of thinking! This is great, I was very happy to see that and at how well it went.

Stuff I want to watch out for

Like last time I taught this course, I notice people have a lot of trouble translating a problem into programming steps, even if they know all the programming pieces to solve it (e.g. add a limit to the number of guesses in a "Guess the number" game). It's normal since people are really just starting out, but I really want to do whatever I can to help address this as early as possible.

My plan will be to try to include some code reading, perhaps at the beginning of a session, hopefully starting next week. It has to be a clever and readable way of solving a problem, that won't take us too much time to go through but will ideally show a new way of using a concept we know or using it to solve a new kind of problem. For the simpler stuff I will likely have to write those snippets myself, I hope I can come up with something good involving while for Monday (I have family over this week-end as well, though).

Looking forward to next Monday!

Leave a comment

Teaching, edition #2

Last Monday I started teaching my introduction to programming course, edition #2 to a small group of adults this time. Here are a few thoughts from the evening.

Installing Python and an IDE

First of all, as expected getting Python to work on multiple platforms as well as more or less getting everyone to use the same editor was a misery. I settled on having Geany or IDLE in the end. We kinda gave up on Windows, though I got some additional info from a friend since then that should be helpful if necessary. Despite that experience, I would expect just as much pain next time. Note to self: bring several usb sticks with all the binaries to pass around, one isn't enough. I wish Geany would work out of the box with Python on any platform, that would be so awesome and convenient. It really is a great IDE!

I was briefly pondering whether it'd make sense to simply make everyone use Ubuntu (e.g. as a LiveCD, with a usb stick to save), but Jannette made a good point that people would likely never look at it again after the course.

Pace

I suspect one, perhaps two people are a bit frustrated by the pace but I think it works for most otherwise. I'm not interested in rushing through concepts in any case, but next time I may have to work even harder at explaining that this course is an introduction to programming, not to Python.

It would appear I've somewhat learnt to size my lessons better. To be verified at the next session though, I had no control over how long the installation phase lasted.

Preparations

For the material, I reused and expanded on my lessons from last time. As before, I had the same issue with the lack of exercises for simple concepts, although I still believe they matter a lot. If people miss anything at this point they will struggle to the end. I must find and create more of those. (Ideas welcome! Mostly exercises to do with text display/variables/user input, and nothing more.)

Interacting with the students

I didn't like when someone popped in and was a bit disruptive, making disparaging comments about Python and comparing concepts with other languages. I don't think it's helpful to do that when someone is learning them for the first time, you need to give a chance to let concepts sink in before explaining variations. I was very bummed out by the whole episode and also by my reaction, all in all it was a very light hearted interruption and if I want to become a better teacher and go back to teaching teenagers, I really need to stay cool and not get flustered. Cutting myself some slack this time, I'm still an apprentice and this is the first time teaching in the big outside world, but definitely something to keep an eye on and improve upon...

Overall adult students are a lot more active than when I taught younger people! They ask a lot of questions, which makes me very happy :) It does make sense, the whole "I have lots of adult responsibilities therefore very little time, if I show up, sacrificing the time I could be using to do other things, and also pay money for something I will make the most of it!" Or well, that is my theory behind this variation so far.

I hope the students will feel free to share more of what what works and doesn't as the courses goes on. I definitely plan on asking for overall course feedback at the end, and hope people will share their thoughts to give me a chance to improve :)

I got some helpful feedback already:

  • I was told I went too fast on explaining int(), what it is, the conversion and why it's needed. The truth is once again I ended up giving an exercise that required using int() to convert user input and forgot to spend time explaining it properly beforehand. Grumbles!
  • So far, Mike is happy \o/
Leave a comment | 5 so far

Django admin actions and intermediate pages Tagging multiple articles at once

The other day I created an "Ireland" tag on this blog and thought, hey, wouldn't it be cool to go back and tag all the posts I wrote about events in Ireland, so I have an easy way to see what's going on locally?

Of course retagging each post manually would suck so I decided to create a new Django admin action, with an intermediate page that would present me with my current list of tags so I could select one, then update.

I also wanted:

  1. To keep the Django admin look and feel
  2. To have the nice admin message "X posts were successfully updated"

Now the Django documentation is very clear at explaining and showing how to do each of those, but not together.

Here's how I ended up doing it, see links at the end for other helpful resources. I'm quite pleased with this solution because it's done the Django way (through the use of forms, etc) rather than by working around Django.

Directly in the ModelAdmin section for blog posts, create an inner class for the new form (tag picker in my case), and a function to process the form like you would in a normal view. Don't forget to add the new method to the actions list.

    actions = ['add_tag']

    class AddTagForm(forms.Form):
        _selected_action = forms.CharField(widget=forms.MultipleHiddenInput)
        tag = forms.ModelChoiceField(Tag.objects)

    def add_tag(self, request, queryset):
        form = None

        if 'apply' in request.POST:
            form = self.AddTagForm(request.POST)

            if form.is_valid():
                tag = form.cleaned_data['tag']

                count = 0
                for article in queryset:
                    article.tags.add(tag)
                    count += 1

                plural = ''
                if count != 1:
                    plural = 's'

                self.message_user(request, "Successfully added tag %s to %d article%s." % (tag, count, plural))
                return HttpResponseRedirect(request.get_full_path())

        if not form:
            form = self.AddTagForm(initial={'_selected_action': request.POST.getlist(admin.ACTION_CHECKBOX_NAME)})

        return render_to_response('admin/add_tag.html', {'articles': queryset,
                                                         'tag_form': form,
                                                        })
    add_tag.short_description = "Add tag to articles"

And here's my intermediate page (quite simple!), which uses the admin look & feel and is located in templates/admin/add_tag.html.

{% extends "admin/base_site.html" %}

{% block content %}

<p>Select tag to apply:</p>

<form action="" method="post">

    {{ tag_form }}

    <p>The tag will be applied to:</p>

    <ul>{{ articles|unordered_list }}</ul>

    <input type="hidden" name="action" value="add_tag" />
    <input type="submit" name="apply" value="Apply tag" />
</form>

{% endblock %}

The hidden field is essential for Django to recognise the form submission as an admin action.

Resources:

Leave a comment

Python Ireland August meetup Community building & education

Python logo

The talks

I happily went along to the August meetup of Python Ireland last Wednesday, where as I expected the community talk was very interesting. Kevin showed us the results of the surveys he sent out after PyCon Ireland (survey says: 100% satisfaction!), and a second one to understand the Irish Python community better -- mostly, "who we are" since we don't really know! Some people show up at meetups, or events, many many more are on the mailing list. Vicky posted up her notes of the talk for an idea of what the survey touched on. I was interested in the results although they are to be taken with a grain of salt: not everyone filled out the survey, and perhaps some questions could have been phrased differently as I found myself realising a couple of times that I completely misunderstood the question as Kevin was explaining "we asked about blah blah blah". Oops! I'm sure the data is mostly valid still :o)

An important section of the survey and thus of the talk was about what we we could -- and wanted to -- do as a community to raise Python's profile and reach in Ireland. The survey had many cool ideas, asking non-anonymously what people would be willing to *actually* help out with. Likely subgroups of 5 people or so will be formed to follow up on some of these ideas, with people with not as much time welcome to chime in if they're interested.

The Redis presentation got cancelled, but Brian gave us a quick tour of the highlights of EuroPycon. I've never been, but from what I understand despite being quite good it was not as good as the previous years.

Pub topics

We headed out to the pub afterwards, where we promptly tried the concept of "topics" that Kevin had brought up in his talk. Basically you divide people/tables by topics and interested people can gather around and discuss and/or make progress on something. I'm not sure whether that kind of structure can really work in a pub context, it tends to be more ad-hoc. You start something along and then you call people over you know would be interested. It was a bit difficult to get started but based on the interesting conversations that ensued I'd be willing and curious to try it again.

If someone dangles a piece of paper with "Education" written on it there's no way I can *not* pay attention so I broke from my current conversation to sit at the table.

Education: Second level

We basically divided the group of people we could reach out to ("educate" I guess) into 4 groups: secondary level, third level, professionals and hobbyists, kinda merging the 2 latter as the discussion progressed. For some reason I just don't care about reaching out to professionals, or about certifications. Those topics are plain uninteresting to me. Ah well. Teaching high school students and somehow getting through to college students is a lot more interesting, and we agreed transition year students were really the best target for the secondary level cause. I want to look into this again once I'm done with my adult course.

There were suggestions of training secondary level teachers so they can teach how to program, which struck me first as a bit unfair. If there are interested teachers though, that's very very cool and I'm more than willing to help out! But I wonder how realistic that would be. The few teachers I met seemed either overwhelmed or stoically accepting of how much more knowledgeable and comfortable their students are with computers. On the other hand I was never asked any particularly complex questions by my teenage students during my short course, so it might very well be worthwhile to focus on teaching the basics of programming to teachers instead. They would certainly have a better reach.

Education: Third level

Third level outreach would be about giving more perspective and teach an additional language to students, who tend to be only exposed to Java through college years. That's the strange relationship between employers and Universities, employers want graduates they can put to work instantly, Universities would like to teach computer science, and students would like to learn something that will get them a job. So I understand why students might limit themselves to Java initially, but still if we present Python correctly, as an alternative it would be very worthwhile. There was the idea of helping students through their homework, using Python to solve the problems. I wonder if it would attract the right kind of students but it sounds worth a try. Outside of the meetup I had also talked about this with Cheryl who suggested I might try to teach an introduction to programming (using Python) to college students before their course begins. Particularly targeting women to help even the playing field a little (see this link about meritocracy & third level computing courses) though of course open to everyone.

Alan and Kevin should be posting their notes from the evening and the various "what we can do" for each target group. What I'm transcribing here is a mix of the actual conversation and my bubbling thoughts :)

I left as the group kind of disbanded to crash the "website / online presence" table topic, as this came up many times while we were talking: we should highlight what companies are using Python, and link to resources for people looking to get started with the language. From the response to my course, people in Ireland definitely have an interest in learning!

Leave a comment

Python course for beginners in Dublin

I finally started to put the whole organisational part in motion before going to GUADEC, and now I'm finally starting to publicise the course! I'm going to teach again my Python course, for adults this time, for people with no programming background. The course will start on August 23rd and last 5 weeks. More information about it on Tog's website!

Any question or query, please do not hesitate to contact me.

I wonder how teaching adults will differ from teaching teenagers... That should be very interesting (and scary, of course! :))

Leave a comment

PyCon Ireland 2010

What an awesome, awesome conference this has been.

Saturday

Many interesting talks and presentations on Saturday, mostly on different aspects of web development (saw 2 on measuring and improving UI performance), one on Clojure (I'm glad I know more about it though I still don't feel interested enough to want to give it a go yet) (Scheme is higher on the list!), a dynamic introduction to writing your own XMPP bot. There's a few talks like the Python puzzlers I want to catch on video when they're available. I saw lots of people with N900 around and oh, how I lust.

The venue could have used some air conditioning but besides that it was great, especially in the afternoon once there was more talks going on at the same time, so the rooms were less likely to be filled up. The corridors were not blocked but because the space was still, let's say cosy you would often end up besides someone and just strike random nerdy conversations. I really enjoyed that and met some very interesting people.

The evening was very well organised as well. Tasty dinner in the Radisson then live music, way too loud like Irish people tend to like (?), but after moving away a tiny bit further with a couple of attendees I met at the bar  we were able to talk about Tog and other topics. Lots of people asked me about the hackerspace over the week-end actually (I was proudly wearing my Tog tee-shirt on Saturday!), it's great to see people so curious and inspired by the idea.

And oh, the swag. Yay! Tee-shirts my size!

Sunday

I'd never been to a Python sprint before so I wasn't sure at all how it organises / self-organises. I felt very inspired by the XMPP talk from the day before (such simplicity, and yet, such power!) and I wanted to give a go at the sample bot the speaker, Victor Hugo, had published on GitHub before the talk. So I ended up with my name on a whiteboard besides XMPP, heh heh. At the beginning of the day one of the organisers asked us what we wanted to "lead a session on" and put the names, topics and rooms on a whiteboard. People were free to add up other topics as the day went along, or drop by on a session they were interested in.

Overall this felt like one of Tog's synchronous hackathon except more organised. I was delighted when someone showed up a bit later who was curious about XMPP too and sat besides me so we could work at figuring it out together. Having the speaker sitting nearby was handy too to answer questions on some aspects of XMPP communication through Python. After having the basic code running I decided to try to scrap my favourite dictionary website, wordreference.com to get basic English to French / French to English word translation. It took me longer to remember how to work with BeautifulSoup than adding the XMPP command but still, it works and was good fun. (The code is here!)

After the tasty lunch at Boticelli, I went to the "Python: building community" session, which touched on topics  like enabling newcomers to join the community and feel welcome, how the existence of a Python certification would help increase Python visibility and credibility with employers, and then one of my favourite topics, outreach to students and younger people. I got a lot of energy out of that last part and I'm motivated to set up my "introduction to programming using Python" workshop/course that has been postponed since June. More on that on this blog soon. We talked about organising quarterly events such as sprints, particularly aiming to involve university students which should be great fun too.


I'm delighted with my (quite exhausting!) week-end, and very thankful to the conference organisers for enabling us to have such an awesome time. Very energising, or as I should be saying: it was great craic.

Leave a comment | 4 so far

PyCon is on tomorrow!

PyCon Ireland begins tomorrow! There might be a few tickets left to be bought at the door, if you haven't gone one yet. I am looking forward to it immensely, and should probably head to bed soon if I want to make it in time for the early start :)

Leave a comment

Python Ireland meetup

I'm very glad I was able to attend Python Ireland's March talks meet-up last night, it's the first time (at last!) that I got to hear the Python chaps presenting, some very interesting stuff. Apparently they're doing a "return to the sources" with more introductory talks, after some time of in-depth technical talks that very few people were actually able to get. I think it worked well.

Python logo

The first presentation was about Jython. Until then I hadn't thought much about it, besides "yeah, Python on the JVM. Why not." Turns out there's some really cool stuff going on there! The seamless Java <-> Python integration evokes a realm of possibilities I hadn't considered before (I thought it simply ran pure Python, I didn't know about it talking with Java and the use of java.lang.reflect.) Jython also integrates with a few Java containers, like JBoss and WebSphere and that's something I definitely want to look into and see how useful it could be in work to help script our build environment. Learning Python version 2.1 should prove interesting...!!

Jython doesn't use the GIL, enabling real multi-threading. Web frameworks can run on it too, some of them tested and confirmed like Django. The thought of Django running on a heavy weight "enterprise" Java container/server brings up a smile, for some reason. All in all a very informative talk, that not only made me want to try out Jython but also dig deeper into the Python language to find out more about some of the concepts that were mentioned.

The second talk was a summary of some sessions from PyCon 2010, quite interactive with the audience asking questions. Some interesting discussions about performance, the GIL (serious case of busy wait on multicore, fixing-in-progress), Unladden Swallow (aiming at 5x better performance and actually getting there, huh. Cool!), an interest in NoSQL databases (tending toward Cassandra and MongoDB rather than CouchDB, interesting), some packaging discussions (highlighting that it was often easier to install (using easy_install) than remove (manually :)). There must be something to learn from the way Linux distributions have been doing it for 15 years now. They're getting there.) Having "poster sessions" for people to present a project without doing an actual presentation is quite an interesting concept. I wonder if this would work for other local conferences, like OSS Bar Camp.

Leave a comment

Teaching Python, session 2! Reflecting on the process

I went through my 2nd Python teaching session today, with the same students than last time. Some improvements and still, so-so-so many things to improve. Teaching is something I really want to get better at so I'm really motivated to debug my process.

Having prepared more exercises to hand out worked really well, until it sort of backfired on me. Since we last met about 3 weeks ago, what I had in mind was quickly recap what we did last time, then do some revisions exercises to really remember what we did. My plan for the exercises was to have several for each concept, and move on to the next concept when everyone has completed at least one exercise. That way I had time to walk around the class and help students having trouble, while the more advanced students can still keep busy and learn more/get more familiar with the concepts. This worked very well at the beginning, until students kinda refused/didn't pay attention when I tried to move on because the competition spirit had kicked in and most of them wanted to finish all of the exercises (even working through break time to get it done!).

So once again we only went through half of what I had prepared, except this time it's more because of my unability to lead the class (it's also very awesome to see students so motivated to learn to program :D) than because I wasn't sure how much to fit in a session. I will need to control the schedule more if I want to get to some of the REALLY cool stuff (or at least get through all the basics!). I need to allocate more time to introduce new concepts and introduce them better. I suspect I kind of suck at explaining programming, and because I was looking forward too much to helping out students individually I kinda went too fast or just didn't try hard enough to explain in many different ways (it's really hard to explain programming concepts. I'm much better at helping people debug their programs, so far.)

3 hours is very damn long, but I don't have a lot of control over that for this group of students. I might try 1h15 / 30 mins break / 1h15 next time. What happened today was that after the initial burst of energy and working through the first break, students just started losing focus, being distracted and having a hard time getting interested. I'll have to write lesson plans that take this into account better.

Or if I get better at understanding what teenagers find cool I can sprinkle that toward the end ;) I completely underestimated how much of a killer "import random" would be. Suddenly their while loop with 'if' giving hints and 'if' limiting attempts, became a real game! (It was a "Guess the number" game.) That definitely woke people up. They were delighted to have made a small program they could actually use and play with. I was postponing introducing "random" because I wasn't sure it was a good time to introduce libraries. In the end I don't think whether it was a library or not mattered or registered. Maybe that just goes back to me not being great at explaining concepts, or maybe seeing really is just a hell of a lot better than talk.

I'm still processing today's session, to figure out where to improve in my preparations and the actual teaching. I think the handouts worked well as part of the recap. As usual, tips, advice and "ew can't believe you tried to teach it this way" very welcome! In the meantime, I'm moving next week and need to learn pygame so I can teach it in two or three weeks... :) Fun and busy!

Leave a comment

Teaching how to program, first impressions

Armed with my laptop and some notes, which I had spent the previous evening annotating then annotating the annotations, I stepped into the room where I was to teach my 7 (actually 6) students the basics of programming and Python.

The short version is, I think it went well. There is obviously so, so much room for improvement and I'm very motivated to work on the stuff that went less well. But all things considered, I did my best and nothing went horribly wrong. Thanks to those that took the time to post comments with advice or to send me encouraging emails! I really appreciate it.

I enjoyed the most helping and having conversations with students one-on-one while they were working through the exercises, compared to the bit at the beginning where I explained what Linux and open-source was about, and what we were going to do (I was using a conversational style but still, no one would answer my questions). Once I was making rounds checking individually if everyone was doing ok, people weren't afraid to ask me questions and I like that, although it could just be that I was working with some really cool kids :)

A few of the points to improve on I took from that day:

I completely underestimated how long it would take us to get through the simple concepts. I thought I would run out of material well before the end of my 3 hours time slot but we didn't go through half of it. And thinking back on it, I probably should have spend more time on the very first concepts, and insist on the "details" like say indentation. Thankfully I get another chance to get it right when we meet again in 3 weeks :)

Something I absolutely need to fix for next time is the quantity of exercises. I need many, many more, and particularly for the simple stuff which I hadn't prepared at all. Examples are good and necessary to get started, but exercises are best. They're great for me as well to see what's causing problems or confusing students, because that stuff is so familiar to me, it's hard to realise what goes through the head of someone to whom the concept is shiny new.

Another thing I found difficult and need to improve on is managing students needing more time and personal attention, because after a while I feel like I'm letting the others down. Having more exercises would also help alleviate this, I think, because at least other students would be able to keep busy and get more comfortable with the material, rather than wait for me to give them more things to do (my failure again here, obviously).

Overall most students seemed to be having fun, and some were curious enough to ask me what we were going to do next time. I hope they do show up for the next session and give me a chance to explain again the concepts I wasn't clear enough on this time.

My main TODO for the next session: have about 20.000 exercises that use print / variable / user input / if statements (or 20 at least, to begin with ;)). Any idea, input or pointers to resources, as simple as they might seem, are very welcome! I think I will prepare some silly on-screen questions as well, particularly to drill in how variables work.

Leave a comment

Teaching how to program

On Wednesday, I will be teaching a small group of teenagers how to program, using Python. I'm both extremely enthusiastic about this, and scared out of my mind. As the day actually approaches, my mood tends to oscillate toward the latter more often :)

I have prepared some material... I think enough for the first session. But really, I don't know. I think the pace of the first lessons is ok, but then I wonder if it's too boring. I have prepared some cool examples that progressively grow out of the concepts we learn, but then I wonder if it's too much at once, or if I'm stretching the examples too much. Will this be entertaining enough to hold the attention of 7 teenagers for a couple of hours?

I know this will be an excellent learning experience for me. I'm very familiar with the material so I'm not concerned about this, although it will be a curse at first while I try to remember what it's like to learn all those concepts for the first time. I'm more concerned about being able to find different, good metaphors to explain the same concept in different ways. That's where I fell short last time I tried to teach someone. I wonder if there's a course somewhere that teaches how to think like that :) I am very motivated to learn, and while I do so, I will try my best to at least not turn  these people off programming forever...!! (No pressure.) I suspect there are some things about teaching, that you can only learn while doing it. Don't take my word for it just yet, though ;)

Any tip, advice, suggestion or word of encouragement very much appreciated! I will post the material I'm using after Wednesday, once I get a better idea of what actually fits in one session.

Leave a comment | 3 so far