the further adventures of

Mike Pirnat

a leaf on the wind

« Previous Post Next Post »

How Does Your Software Garden Grow?

Farewell to Daffodils
Farewell to Daffodils
Originally uploaded by mikepirnat

Every time I spend a few hours working in my garden, I find myself inescapably drawn to the parallels between gardening and software development. Whether you're digging in the dirt or head-down in code, there are many lessons from one that are equally valid and valuable in the other. Here are the ones that I keep coming back to:

  1. Vision: Whether you're planning a garden or starting a new program (or maybe just implementing a new feature), you need to have a vision for what the finished product looks like, and always keep it in mind as you build toward it. Without some discipline to guide you, your code garden will be a disharmonious mish-mash with no direction, and your efforts will be wasted.

  2. Vigilant Weeding: Your garden and your codebase are going to be under constant assault from weeds of all kinds. It might be thistles and dandelions, or it might be subtle bugs and poor designs, but only your continuing vigilance keeps them from getting out of control and spoiling what you're trying to achieve.

  3. No Mercy: Is something not working out the way it should? Has a bush grown into an oversized monster? A class gained so many features that it's unmaintainable? Something just not flourishing? Don't keep it just because it's already there--refactor. Rip it out. Replace it with a better alternative. You won't really miss it, and the eventual result will be better off without it.

  4. Openness to Change: The original vision might not be attainable; that's okay. Rethink the vision and you'll probably come up with something that will be even better than what you thought you wanted in the first place.

  5. Keep an Eye on Your Neighbors: Pests like grubs and dandelions don't respect property lines, and neither do bugs, bad designs, or performance problems in systems that your code may have to talk to. Be on your guard for nasty things that might leak across and foul your work. Wall them off and isolate them before they move in permanently.

  6. Use Good Tools: One day, I got fed up trying to dig a hole with the same old shovel that had been in the garage forever--an old hand-me-down even when it came to us. I broke down and bought a new shovel; the blade was sharp, the handle more comfortable. It felt good to use, it took a lot less effort to get the job done, and I didn't hurt after using it. So too in software, using modern tools like a DVCS can be a lot more effective than older, worn-out counterparts.

  7. Know How to Use Your Tools: Whether you're in the garden or hacking on code, you need practice and knowledge to use your tools effectively. You'll save time and be far less likely to injure yourself (or those around you).

  8. If It's Worth Doing, It's Worth Doing Right: You wouldn't drop a bunch of money on new plants only to have them die without fertilizer or water. So write tests. Practice good methodologies. Don't skimp on documentation or streamlining your deployment. Don't half-ass it, or you'll pay for it eventually--and probably a lot sooner than you expect.

  9. It's Alive: Your garden and your code are organic, living things. They need your love and devotion, your sweat and toil, if they are to grow successfully. Sometimes that love is tough, but it's necessary.

  10. Take Pride in What You Do: At the end of the day, it's nice to relax and enjoy the beauty and you've created, to appreciate the small oasis of order that you've carved out of the entropy and chaos of the world. You want to be able to enjoy the fruits of your labors. You don't want your yard or your code to be an eyesore that all the neighbors complain about.

  11. Enjoy What You're Doing: If you're not enjoying it, you're doing something wrong. Figure out what's keeping you from being happy about your work and do something to change it.

  12. Talk to People: Just as you wouldn't want to plant a sun-loving flower in the shade of your apple tree, you also wouldn't want to use a dictionary when you really need a set. Many problems have already been solved, and there's a tremendous wealth of knowledge and experience out there; whether it's the guy at your local garden shop or the folks in your local user group, you'll be amazed at what you can pick up from even a little bit of human interaction.

If you're writing code but not gardening, try it out and see if you don't have some similar revelations. If you are a coder who gardens, what parallels have you drawn? How has gardening influenced your programming work?

blog comments powered by Disqus

« Previous Post Next Post »