In today's world, is it better to be a specialist or a generalist? A tough question with no easy answer that worries particularly those early in their careers.
On the one hand, we have people like Robert Heinlein, who famously said that “specialization is for insects,” and David Epstein, who wrote a book called Range: Why Generalists Triumph in a Specialized World. They advocate being a generalist.
A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyse a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. (Robert Heinlein)
On the other hand, there's the proverb “jack of all trades, master of none” and the general sense that people will always prefer a subject-matter expert over someone who's good but not great at many different things.
Software developers face this question too. Do you learn a new programming language or do you get better at the one(s) you already know? At what point should you generalize instead of specialize, and vice versa? This article will give a nuanced answer that will hopefully help guide your future decisions.
Software developer is already a fairly specialized profession. You have good working knowledge of at least one programming language. Particularly early in your career and when you're not in a managerial position, it's a good idea to focus on mastering one or two skills.
This means you'll have fewer opportunities than the full-stack developer who can apply for both front-end and back-end roles, but you'll stand out as a better candidate for front-end roles.
However, it's not because you're specializing externally that you should only focus on those areas. That's a dangerously fragile strategy. The tech industry moves so fast that the framework or programming language you've mastered might be obsolete before long.
That's why it's always worth spending some time building other skills too. These can be soft skills, particularly useful in managerial roles, or hard skills like a new framework. Determine how much time you want to spend on acquiring these skills.
For example, a good strategy could be 60% depth and 40% breadth, although it will depend on where you are in your career and on your general disposition. Some people are better at sticking to one thing, others like to experiment with the new and novel.
In addition, you can improve the skills you've already mastered by learning adjacent skills. As X-Teamer Pawel Ngei said when we were discussing this topic in our Slack:
Sometimes I learn a new language (like Haskell) to learn a new paradigm which would be harder to express in my main languages (JS, Python). For me it's not "have a shallow base in as many languages as I can", but "learn different concepts through different toolsets".
There's no single right answer to whether you should specialize or generalize. It depends on your natural disposition, where you are in your career, and what you already know.
But, in general, it's a good idea to specialize externally first, until you've mastered one or two skills, while also spending some time learning either adjacent or entirely unrelated skills. Jack of all trades, master of at least one.