Don't be a Shotgun Coder
Tags: advice, productivity, design
Published: 2018-10-23 13:57:20

> When you work, don't code like you have a shotgun. Pretend like you are a sharpshooter, preparing and waiting for the right moment.

It might be hunting season, but don't let yourself become a shotgun coder.

## Shoot From the Hip

Ever notice how in first person shooter video games, you usually have two strategies to play? You either are the player that lines up every shot down the sight; usually implementing tactical approaches, strategy, and patience to accomplish your goal...

Then you have the people who play the games like me. I am loud, crazy, and shoot from the hip. I might not be as clean or as successful as most people who play these games, but my strategy is that if I attack from the hip faster, with less accuracy, I can accomplish more 😎

But it's weird, because I know this isn't the case. Having strategy, patience, and tactical knowledge will always win over the free-for-all firing of more novice players...and when we draw parallels to software design and programming, don't the same schools of thought exist?

## The Shotgun Coder

> Try to understand and solve problems before you even touch a line of code.

My video game style is similar to my coding habits...I tend to *shoot from the hip*. It's a very, "build first, design later" attitude. I assume that as I go along with the project, the solution will just magically become more clear to me, and I'll have the epiphany that solves everything!

**The Shotgun Coder is one who assumes that by trying every strategy, they will eventually get what they want, instead of sitting back and *really* solving the problem first.** In other words, Shotgun Coders don't want to think for themselves, they would just rather have the computer figure out the solution after they've tried *x* number of attempts.

Back when I was in high school, I was a member of a [FIRST Robotics team](https://www.firstinspires.org/robotics/frc). My team's mentor nicknamed me *The Shotgun* because whenever a problem would come up, or something had to be fixed/added, I would always rush to the code to try different strategies, instead of sitting back and thinking up the best solution first. This approach had a low success rate, led to a lot of mishaps and failed attempts, including an instance where the robot destroyed itself due to some untested code...(Always test, folks)

I see the Shotgun Coder mentality come out **a lot** when [mock] interviewing people. I ask a technical question, and more than half of the candidates jump to code *without even clarifying the question!* 

It helps *so much*, and looks a lot better, if they take a breath, step back, and try to solve the problem without using code. **Try to understand and solve problems before you even touch a line of code.** This goes for algorithms and project design.

## Is There a Way Out of the Woods

*Ha! Shotgun → Hunting → Woods...oh the titles are great when you explain them...*

So how do we avoid being a Shotgun Coder? Well, think back to the video game argument at the beginning of this post. There's two different types of people...we want to emulate the ones who are smooth, precise, patient, and tactical. They are usually the ones that end up winning the game. Instead of firing from the hip, we should be slow, careful, and have a clear sight to aim for our goals, to ensure we hit the bullseye.

![Bullseye](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcT3i7fyvhBkO0INnKgAjkfq02K-UDLx6a2qY8JkRcMjMMiC9LSSoA)

So what does this mean for coding and designing? 

**It means take your time!**

It is better to take more time planning and preparing a detailed solution, so that you (and your team) don't have to spend so much time *shooting from the hip* and hacking mini-solutions together for problems that weren't thought of in advance.

Would you rather take two weeks designing something, and a week to build it, OR would you want to immediately start building it, only to realize you didn't understand the big picture, all the features, or exactly what the end goal was?...Yea, now what could have been a three week project is now three months in, you've lost your hair, and your significant other has left you because you have nightmares screaming project management terms in your sleep...*CONFLUENCE!!*

This advice goes for interviews, school projects, tests, work, starting a company....anything you can think of! **Don't be a shotgun thinker!** It's good to get ideas out quickly, but its even better to then take those ideas and figure out the next steps before jumping into them.

Take what you have now, take where you want to be, and although its okay to take a few unguided steps along the journey, plan everything out before you start shooting from the hip.