I hear people talking about getting “in the zone”, something that requires total concentration, something that if you interrupt, can take minutes if not hours to find again.

So, what is the zone? I’m not totally sure, but from what I have heard it seems to be some sort of zen-like state that developers need in order to work on a complex problem. A state of mind where the developer finds a total understanding of the code and requirements, allowing then to effortlessly implement a solution.

So why have I never “been in the zone”? And if I’m not in the zone, how do go about solving complex problems?

I start by break the problem down into manageable parts, where I can work on each part individually. This means that when I am writing code I only need to be aware of the current part of the system, relying on the up front design to ensure it fits correctly into the whole.

This does require practise to break up the problem. And I am sure that you are thinking that I would need to find the zone in order to understand the problem enough to be able to break it into smaller component. But that is simply not the case as at this level I am thinking about the top level design, rather than focusing on the impementation or existing code.

The key here is to iterate, if the code you are working on doesn’t seem to work:

  1. take a step back
  2. look at the top level design
  3. change it
  4. get back to working on those small implementations

The main advantage of my approach is that I can swap in and out of tasks easily. I still have a big picture view, but I can easily manage that through peer discussion, design diagrams and integration tests. This in turn allows me to focus on the building blocks of the system, without getting weighed down with designing it all simultaneously in my head.

So if you find yourself needing to find some metaphorical “zone” in order to write good code, can I just suggest that “you’re doing it wrong”?