Article

A year with the cowboy hat

April 10th, 2013

Quite some time ago I read this article entitled "Cowboy coding and the pink sombrero". It's about editing code on the production server and how that's obviously a bad thing™. The writer describes why they wear a pink sombrero whenever they edit code in production.

Now, the article fit right in with my views because it was a very easy way to enhance awareness from within. I'm convinced it could even help lone developers avoid creating a habit that later needs to be un-learned. Can you answer the following questions without thinking really really really really hard?

  • How often did I change code in production in the past 2 months?
  • Was any change on code in production cause for another change?
  • Did I tell my colleagues I was editing code in production?

If so, you might not need a cowboy hat. But if it took even a little processing power to remember the answers, a hat might benefit you...

The first thing you should do, is make the decision to see this through (well, actually, the first thing you should do is get a cowboy hat!). This means from now on, you do not edit any code in production unless wearing the hat. Seriously, if you think this might be a problem, don't get started. I'll spare you a failed experiment right now, you can thank me later. Here's yours-truly wearing our brown leopard-spotted cowboy hat as proof... [gallery ids="606,608,607"] Once you have the hat, place it somewhere easily accessible. Always visible is probably best.

Starting with yourself - always wear the hat when editing code in production. If you own the company and there are more developers around, I'd say don't try to make this a policy and enforce it or anything. If in your current environment developers have access to production servers and change code in production regularly, it won't change overnight. Make sure the purpose of the hat is known, and assuming you are an owner/developer like me, wear the hat yourself - without fail. Lead by example. Perhaps if you don't do any changes to code in production yourself, or spend a lot of time on the road, pick a senior developer and discuss starting the change with her.

As soon as you start the habit of wearing a cowboy hat while editing production code, try to find ways to reduce the occasions that you need to wear the hat. Just reflect once in a while about the changes you made while wearing the hat - those changes should come to mind really easily now. You'd be surprised how much of an anchor a cowboy hat can be! (perhaps, if you're accustomed to wearing a cowboy hat, you should consider other types of headgear...)

What type of changes you make on production code can vary, as well as the solutions involved. But anything that removes the need for a change in production code will be an improvement on the way you develop, deliver and maintain software (depending on the project, we use anything from tiny shell scripts and rsync to capistrano deploy scripts with doctrine migrations). And if your goal is to always improve the way you do things, here's a good book with very useful insights:  97 things every programmer should know.

There's a whole world out there with wonderful tools that can help you improve your deployment process. It all starts with a shift in attitude with regard to editing production code, and in our case: the hat did just that. Good luck!

Ramon de la Fuente

Pointy haired boss

Do you have similar issues? Contact us at Future500

We can tackle your technical issues while you run your business.
Check out what we do or write us at info@future500.nl