What do you enjoy about programming?

Over the last couple of weeks I think I’ve identified one of the main things I enjoy about programming. For me, it seems to be the puzzle-like aspect of it; finding ways to slot small bits and pieces together to create/achieve something bigger. When I’m working on a problem I can approach in this way I find it much easier to get into a good flow where I’m productive, creative and happy.

This idea started to dawn on me while I was in Joshua Kerievsky’s Refactoring workshop at YOW 2011. We were going through refactoring exercises, but trying to take extremely small steps to keep the tests green. The final goal could be achieved fairly easily by moving a few chunks of code around while keeping the tests broken for a while, but I really enjoyed the challenge of finding small steps that would keep the tests passing all the way to the final state.

This was further reinforced at Tony’s excellent Functional Programming workshop, where we spent quite a bit of time trying to fit together various functions (and partial applications of them) according to their type signatures. I thoroughly enjoyed this process, despite really struggling to get the solutions much of the time. I also realised I get an extra kick out of these puzzles when there is an element of elegance or simplicity to the way these pieces fit together. For example, implementing map with folds rather than recursion and pattern matching.

I think identifying what you enjoy about programming (or any activity really) can be an important part of maintaining motivation, and improving productivity and creativity as a result. I’m going to put this idea to the test by trying to break down problems in ways that I can use approaches I enjoy, and see if that helps me get better results, both in terms of solution and my happiness and enthusiasm.

This knowledge also helps me better understand some of my weaknesses. I have spent a lot of time over the years trying to piece together various patterns and practices to try and find a process I can continually apply to create great software. In other words, trying to solve the puzzle of how to develop software. My propensity to approach things as puzzles has probably led me astray here, as the unlikelihood of a silver bullet for software development has been demonstrated time and time again. Recognising this, I’ll try be more careful to make sure I’m solving the right problems, and not just inventing problems to puzzle-solve (although that can be educational as well, provided it’s deliberate).

So, what is it about programming you enjoy? Can you use that knowledge to improve the way you work?