Uncategorized

The Jana Cowboy Hat

A typical development pattern might look something like this:

  1. Pick a new feature to implement or a bug to fix
  2. Write some code and test it locally
  3. Have someone else review your code and make comments
    • Iterate steps 2 and 3 as necessary
  4. Deploy your changes to a staging server (where more tests are run)
  5. Watch the production release and make sure everything is going well

The time spent testing and reviewing code in this process helps ensure that we ship high quality code. Sometimes, however, we need to respond to things that go wrong in production very quickly. When urgency outweighs the risks of bypassing the development pattern outlined above, the best option is to change code live in production, i.e. cowboy coding. To make cowboy coding less dangerous, only one person should be changing production code at a time. For that reason, effective communication among the engineering team is essential.

Until recently, our engineers passed around a physical cowboy hat to designate a cowboy coder in these situations. This was inconvenient for people in the office, and impossible for those working from home. Because of that, some people either did dangerous things without being sure they were the only one taking action, or they tried to work around the issue when the best thing to do was to jump in and get stuff done. As our team continued to grow, using a physical cowboy hat became less feasible, so we sought a digital alternative — a cowboy robot, if you will.

For Jana’s quarterly hackathon, I built a custom Slack integration that lets our engineers put on a virtual cowboy hat in Slack if they need to change code live in production. Some of the available Slack integrations, like Giphy for example, are ready to go out of the box. Others require some coding, but provide even more flexibility. In case you aren’t familiar with Slack, if the beginning of a message starts with a slash (like /giphy puppy), Slack will look for that command and execute it if it exists. My cowboy robot, affectionately dubbed the John Wayne Bot, is built on the custom slash commands integration. We have a server that listens for someone to type the command /cowboy, parses the arguments, does some cowboy logic, and sends a message to our engineering Slack channel accordingly.

Using the bot is pretty simple. If you type /cowboy anywhere in Slack, the bot tells you who (if anyone) has the hat on and how long they’ve been wearing it. Type /cowboy on to put the hat on, and /cowboy off to take it off. The bot will only let one person wear the cowboy hat at a time. Here it is in action:

cowboy_bot

Since I joined Jana only a few months ago, I didn’t have time to develop an emotional attachment to the physical cowboy hat, but I think I can safely say that what we lose in tangibility and sentimental value with this change, we make up for in efficiency and practicality.

Interested in this Slack integration? Let us know. We might open-source it.

 

By the way, we’re hiring.

Discussion

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s