· coding learning

Coding: Contextual learning

While reading my colleague’s notes on a brown bag session on pair programming she gave I was reminded of my belief that we learn much more effectively when we are learning in a practical environment.

The bit that interested me was this bit regarding onboarding:

On board new team members to bring them up to speed on the overall goal and design, so you do not need to repeat basic details when you work with them on a story.

It’s fairly normal for the Tech Lead to give new starters on a project this kind of overview and although it is useful as a starting point, nearly everyone I have worked with is keen to see how these ideas are implemented in the code.

I think there is still a place for the presentation/context free style of teaching but we should look for opportunities to get people into the context of what they are being taught as often as possible.

Pair Programming

I’ve written about this quite a few times in the past so I don’t want to labour the point, but this is by far the most effective learning approach that I have seen so far.

It works especially well when at least one person is skillful in the technology currently being used. Obviously it works even better if both people know it but it is useful to have one person who has the ability to teach the other.

Being shown how to do something and then trying it out yourself is much more effective than having someone talk about it at a more abstract level and then trying to apply what they have taught.

For example, we have been discussing recently how to write better Javascript/jQuery code and all the things talked about make sense but it didn’t really click in my head until I got the chance to work with some colleagues who were really skilled in this area. I’m certainly not an expert but having this opportunity has given me the chance to improve more effectively.

Coding Dojo Style Learning

We have been holding some Coding Dojo sessions over the last couple of months in the ThoughtWorks Sydney office and I think they are really useful for helping to spread best practices.

For example, one of the key ideas of TDD is that we should take small steps, at all times making a change and then running the tests to make sure we didn’t break something. In a pair programming session it is quite easy to ignore this guideline and then suffer the consequences, but with 5 or 6 other people watching you make that mistake it is much less likely to happen!

I haven’t seen this approach used on a project yet, but Alan Dean has been posting on Twitter recently about using a Coding Dojo for a refactoring session on the code base he is currently working on.

This certainly seems like a more effective approach than talking about how the code base needs refactoring in a white boarding session without being able to show exactly what is meant.

And if you must whiteboard...

Although I think these other two approaches are more effective, the whiteboard is still an effective tool as long as we use it in an interactive way. If it's just one person drawing stuff out and others are not having any input then from my experience it's not going to be an effective way to learn. A far more useful approach is for the first person to start drawing out their ideas and the others can then add to this to check that their understanding is correct. Although this is a useful exercise, it certainly makes sense to then go and try out those ideas in the code to ensure that you actually did understand what was being discussed.

Overall

I think the thing with all these approaches is that they are designed for small groups - with pair programming just two people for example!

I’m not sure how we could get the same effectiveness of learning with a bigger group - certainly the university style of lecturing is not the answer.

Whatever approach we take, keeping people involved and keeping it contextual is the best way to go.

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket