Monday, April 18, 2011

Coding in non-sequential order

In the latest episode of Talking Shop Down Under, Xerxes Battiwalla brings up an interesting tatic he uses when tutoring university students in computer science. Firstly, unsurprisingly, he encourages problem decomposition, walking the students through breaking the problem down into smaller parts. But he then encourages students to complete the problems in a random order.

I like this approach for a couple of reasons-

Firstly, it weakens the opportunity of making your various inputs/outputs/DTOs too specific. I remember my code becoming more and more interconnected and bespoke, as I resisted refactoring previous code in order to keep soldiering on.

Secondly, it gives a leg-up to testing. If you start in the middle of a problem, with no GUI or input, then the value of unit testing becomes obvious.

And lastly, it’s a neat piece of reference framing. It shows students that each component in a coding chain has value. It also shows that if they are unsure on one part of the problem that they can still start on a different part.

No comments:

Post a Comment