I enjoy code retreats. I had the pleasure of co-facilitating a Global Day of Code retreat session during my time at Unruly, and I’ve participated in others over the past few years.
The thing I like most is the addition of constraints during the day to spark creative solutions or ways of working. Pairing on a simple problem like Game-of-Life or Rock-Paper-Scissors can be made more interesting by doing things like:
- Being an “evil pair”, and only making your partner’s tests pass in the strictest sense possible
- Coding in silence, and only communicating through the code written
- Writing in a purely functional paradigm with no shared state
This inspired me to create a constraint when recently thinking about the way I write code, that I think of as “tweet-driven development”.
What would it look like if each new piece of code was limited to the size of a tweet? (280 characters)
I wrote a small script, that I enable as a pre-commit hook, called git-max-commit-size
. It enforces a limit on how much code you can add in a single commit, but no limit on how much you can remove (this limit exists already - it’s the size of the codebase!).
Code is a liability, not an asset, so let’s see what happens when we make it more expensive to add things but not to take things away.