The Golden Hammer & Range

Why You Need Career Shifters Like Me

Source

While continuing my Udemy course on web development, I came across an interesting concept. The instructor explained an architectural decision he had made, he was going to use the CQRS pattern. The comments section was flooded. Why use that pattern? Why not use plain CRUD? Are there other alternatives? To address this, the instructor brought up the golden hammer anti-pattern which essentially says there isn't any one pattern that will work for everything.

The Golden Hammer? What Is It?

The golden hammer in software development is an anti-pattern. A common response or practice that is considered bad practice and is usually ineffective. Something we want to avoid basically.

The concept is quite simple. There is no such thing as a tool that will work for all cases- or a golden hammer. So if you believe your tool to be so great with no equal and can work anywhere…. hmm, that's a problem!

“If all you have is a hammer, everything looks like a nail.”

There are many choices that are made during a software lifecycle. What programming language? What framework? What type of API? What design structure/ pattern? The choices are endless! Normally there isn't one correct right answer either, but rather benefits and tradeoffs. You have to consider the technical requirements, the business constraints, and finally personal preference.

Now the golden hammer anti-pattern comes in when instead of acknowledging the tradeoffs and benefits, developers simply rely on what they already know. They are over-reliant on their familiar tools. Instead of assessing the problem and coming up with a suitable solution, the same solution is applied regardless of the problem. In fact, the solution has been chosen before the problem is even clear! Now that doesn't make any sense.

The issues it can cause:

Not only does applying the same solution to every problem not make sense, but it can have consequences. When developers are not willing to consider alternative solutions or explore new technologies it will lead to inappropriate solutions. The solution could perform poorly due to it being not the most efficient or be overly complicated or redundant for the task at hand

Why does it happen:

Firstly, this anti-pattern can arise both at an individual or team/company level. Some of the main reasons include:

  • Familiarity- It easy to love what you know. Once we learn a new skill and are comfortable using it, we want to apply it everywhere and we think it's great! Especially if it's been working…
  • Repeated Success- Once we see a solution working we think “if it's working, I'm sure I can keep using it”. However, this can lead to…
  • Ignorance/ Isolation- Sometimes we simply don't know that there's a better option there. And we especially won't find it if we aren't looking.
  • Lack of Motivation- It's a lot easier to simply say “that's how I’ve always done it” and move on. This lack of motivation may even be encouraged by a company because of:
  • Large Investments- Whether it be in the technology or the training to use it. The more time and energy spent, the more likely you are to want to keep using that solution.

At the end of the day, nobody likes change, and imagine having to learn a whole new toolset for every project you come across. That’s a lot of work. It's easier to stick to what you know, but that comes with consequences, so there must be a better way.

How To Avoid It:

To ensure we don't fall into this anti-pattern we need two things. We want to be able to use and have different tools available for different use cases and we also want to be able to adopt emerging trends and standards. This will lead to efficient solutions. To achieve this, you must focus on the following:

  • Evidence- Before selecting a technology or choosing a design pattern, provide evidence and reasonings for the choice. Why is this option better than the other? This forces you to at least consider alternatives and clearly outline the value of the solution chosen.
  • Gaining New Experiences- The more you build and learn the easier it will be to recognize the golden hammer anti-pattern. By consciously seeking new technologies and solutions you will have more tools in your toolbox.
  • Open Communication- Encourage an exchange of ideas within a team or company. Someone else might help you not be narrow-minded and see a solution you hadn't seen before.
  • Diversity- Focus on having a team made up of people from different backgrounds. This allows for technical diversity as well as a broader experience base to draw upon.

Conclusion

The golden hammer anti-pattern is simply a cautionary tale on being too narrow-minded or getting too comfortable in your decisions. The field of software development is constantly changing. By always sticking to our favorite tools, we hinder innovation.

As software developers, we use our tools to solve problems. After reading this, I hope you question the tool in your hand right now. I guarantee you, no matter how great it is now, one day you should put it down for a better one.

Power of Range

RANGE: Why Generalists Triumph in a Specialized World by David Epstein

Before I stop typing, I want to relate the concept of the golden hammer to a book I recently read. Range, by David Epstein, makes the case for generalists in our increasingly specialized world. I’ll admit, I chose to read this to try and ease my concerns about the career switch. Will I forever feel behind?

However, what I forfeit in a head-start, I make up for in a match in my skills and talents. My diverse background also allows me to see the bigger picture. The final point on how to avoid the golden hammer anti-pattern was diversity. That is exactly where someone like me comes in and provides the most benefit. By having a non-traditional background, we able to integrate broadly and draw from a range of diverse knowledge. Our greatest strength is the flexibility in thought, the exact opposite of narrow specialization.

Additionally, when it comes to picking up new tools and dropping our “familiar tools”, we have proven experience. In fact, that's exactly what I’m doing right now by learning software development. Continuous learning is required in this field and I’m proving that I have the ability to pick up new skills and keep learning.

I’d recommend this book to anyone else going through a shift in their career. You are not behind, you are exactly where you should be.

References:

I love seafood, exploring new cities, board games and learning to love to code. https://github.com/sarakhandaker/portfolio