November 19, 2004

Teaching, Learning and Listening

That's it, I'm buggered (to use the Australian vernacular; in other words I'm very tired).

Having finished a week of teaching, I am reminded about one of the things that I was told early on after first joining a consulting company: the best way to learn is to teach. I'm talking about learning content here, not learning how to teach or discovering higher philosophical truths about life, the universe and everything.

This week I was co-teaching. Yesterday I had the chance to teach a couple of topics that have been relevant since version 2.3 of the Java Servlet specification: Filters and Servlet Event Listeners. I knew a bit about Filters having actually used them in anger. But what were these Listeners all about?

As it turns out there's not much to know about them and they are potentially useful devices. Need to monitor how many concurrent sessions are being used in your web application? Well, Servlet Event Listeners are for you. They allow the developer to monitor events in two contexts: the ServletContext and the HttpSession. For each context there are two interfaces that the developer has it his or her disposal. In the case of the session, the HttpSessionListener facilitates monitoring of the creation and destruction and of sessions whilst the HttpSessionAttributeListener allows monitoring of adding, replacing or removing attributes from sessions.

I can imagine these event listeners would be useful for debugging code that monitors session attributes to ensure that the application is cleaning up attributes that are no longer required. I wonder what other uses that they have been put to?

Anyway, back to my original point. Teaching is a good way to learn. Even if one knows the bulk of the course material, it is not uncommon to have to teach topics that one has never before needed to know about. And when there is an imminent deadline and you want to at least give the impression that you know what you're talking about, it's amazing how motivating that is!

Posted to Software Development, Teaching by Keith Pitty