Sunday, March 8, 2009

Don't Just the Write Code, Solve the Problem

Curse of the 18 Inch Stonehenge
In the classic mockumentary "This is Spinal Tap", a designer is asked to build one of the Stonehenge triptychs based on designs drawn on a napkin. She builds the triptych according to the specifications and delivers the replica - but the result wasn't what the client wanted: (language warning)



As a web developer for a medium-sized software company, I get requests to build all kinds of things. Sometimes it's simply a process to move data from one place to another, other times it may be a full-blown application. It's easy to fall into the trap of fulfilling requests as they come in, but I've learned over the years that it will save me time and effort as well as please my internal clients if I ask an important question first - what is the problem you're trying to solve or the outcome you're trying to achieve?

The Doctor is In
When I go to the doctor, I don't tell her what medicine to prescribe or action to perform. I describe the symptoms, answer her questions and possibly submit myself to some tests. Developers should see themselves in the same role as the doctor - we help solve problems. Before you write that first line of code, take a step back and think about what the client is trying to accomplish. You may be surprised to find that code can't actually solve the underlying problem. You may also come to the conclusion that the original request is exactly what is needed. Regardless of the decision, the process will help you consider why it is you code what you code.

Code Can't Solve Everything
It's great to feel like an MVP but, let's face it, some problems just can't be coded around. As we look at the problems we're trying to solve we may discover that the problem is actually a bad business process or an outmoded way of doing things. Sometimes we are able to code around those things, but perpetuating bad business habits is in nobody's best interest. Get to the root cause and solve that problem first. Code may help, but often it's a combination of business processes, business logic and even UI inefficiencies.

Sometimes, though, code is the answer. It's certainly part of many solutions. Well designed code can help automate manual processes, ensure data consistency and integrity and make the entire operation more efficient. Like any good machine, code should help the users be more efficient and make their work easier. If you've done that then it's a job well done.

Solve Tomorrow's Problems Today
It's one thing to solve an immediate problem and move on with the next project. Sometimes, that's what we have to do. But it's even better to solve tomorrow's problems before they occur. I try to make my code as future-proof and extensible as possible to avoid having to revisit it six months down the road because business needs changed. By thinking ahead we will save ourselves headaches and make our code more reusable and maintainable. A few things I've done to this end are:

  1. Be a Detective
    When a request comes in ask questions to understand what you're being asked to do. Not only will that help you code the right solution, it will give you understand business processes outside your core domain. It's amazing how much you can learn about marketing, sales and finance if only you take the time to understand the purpose behind the process.
  2. Offer Solutions
    When you see a problem, offer a solution. It's easy to wait for a client to come to you, but you make yourself more valuable by identifying problems early and solving them when you can. It may not be possible to implement a solution right away, but if you have identified a problem and have a potential solution, it will help you code for the future as well as the present.
  3. Solve a common problem
    Things you do over and over again should be a library or class. It may entail adopting a framework from which to build or simply having snippets of code to refer back to. You shouldn't write the same code over and over, though. Reduce, Reuse, Recycle
  4. Know your systems
    Strive to understand the APIs for your CRM, financial and reporting software or the marketing systems that may be in place. Often the coder has more intimate knowledge of what CAN be done than anybody else. You also know the idiosyncrasies and pitfalls of those systems. Use that knowledge to make things better.
  5. Maintain Your Code
    Just like any machine, web code needs to be maintained. It's the most difficult part of coding for me, especially when the code is working just fine. The problem is that new technologies, design patterns and needs come along. The code you built last year may work until it needs to be extended to do one more thing. Constant refinement makes updates quicker and easier and ensures that new requirements don't cause a complete system overhaul.
These are some of the ways I end up avoiding the Curse of the 18 Inch Stonehenge. What are your strategies for delivering what the client wants, not just what they ask for? Share them here, I'd love to know what works for you!