Skip to Content

Day 83: on Tetrising

Posted on 3 mins read

Last Saturday, the 13th edition of the JS Coderetreat took place in the Futurice offices. If you’ve never been to a coderetreat, think of it as an afternoon of practicing your TDD skills around a specific task. It’s usually separated in sessions that look like this:

  • Set some constraints for the session. It can be “do baby steps”, or “no for loops”.
  • Find a person to pair with. Different sessions = different pairs.
  • Work on the task for a set amount of time, usually between 30 to 45 minutes.
  • Time’s up, delete all your code (really, delete all the code).
  • Have a retrospective on the session. Talk about your impressions, what you liked, what you didn’t like, etc.

I’d been to one Coderetreat before and the task at that time was Conway’s Game of Life. It’s a medium size task that gives some room for exploration, while not seeming daunting, and my impression at the time was that it worked pretty well. Every session was different, and I tried different approaches. In the JS Coderetreat, Wolfram wanted to give it a bit of a surprise twist, and so we didn’t do Conway’s. We did Tetris. And it was amazing.

All the possibilities

To see why Tetris was so good, let’s look at all the different angles me and my pairs looked at during the sessions:

  • Start with a piece, that can rotate and move. In this approach, the piece moves itself.
  • Start with a piece, but ignore the board entirely. The board doesn’t exist as long as the piece hasn’t moved in order to create space around it. I must admit, this one was by far the weirdest, approach to Tetris we could’ve thought of. Almost poetic in a sense.
  • Start with lines, figure out when they’re full, and then move on to the board from there.
  • Start with a board that has lines. Figure out how to react when a line is full or not.
  • Start with a 2 dimensional board that creates the concept of lines by outside parameters and not by inside constraints.

And that’s just what fit into 5 sessions. Other pairs came up with completely different and amazing approaches. This is why I feel that Tetris was a great choice, even if a bit of a daunting one. It felt closer to what an actual task would look like, and the amount of different approaches was also a testament to the many ways there exist to write good, quality software.

That’s my main takeaway from the entire day. There will always be someone with another, wildly different opinion on how to solve a problem. And only by opening ourselves to the realm of those possibilities can we be certain that we aren’t blinded by our own perceptions.

P.S: Kudos to Wolfram for facilitating and Larissa (couldn’t find her twitter account ☹️) for organising such an amazing event.

comments powered by Disqus