There is some question as to whether you should live your life as a specialist or a generalist. When I was in high school, I was advised to model the Renaissance Man. Likewise, one of my favorite authors from when I was growing up, Robert A. Heinlein, wrote in the voice of the immortal Lazarus Long:
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, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.
But consider this from the viewpoint of a customer. When you hire someone to do a job for you, you want a specialist. Preferably it is someone who does the same thing repeatedly and has completely mastered it. Not only do they keep up with the latest techniques in their field, they are leading it. Whether it is bone setting or computer programming, a client wants the best.
As Matt Ridley points out in his book The Rational Optimist: How Prosperity Evolves, specialization and exchange makes everyone better off. This assumes, of course, that what you specialize in is a career and not a hobby. You can be the world's leading expert in something, but if no one is willing to pay you for it, you will be poor. Possibly widely appreciated, but still poor. Keep in mind the advice of Aristotle:
Where your talents and the needs of the world cross, therein lies your vocation.
The needs of the world tend to change over time, however, and that is where being a generalist can keep you alive. Environmental changes determine whether the generalist or specialist species go extinct. Us humans, however, are fast adapters. We can maximize the profit in a specialty for all its worth for as long as we can and then move on when the cheese is gone.
Having said that, however, I would like to point out that moving on can be a lot easier if you have some experience with what you are moving on to. This is where your hobbies come in. For the sheer love of learning, you play at things that do not have any immediate pay-off. Bouncing from one hobby to the next makes you the jack-of-all-trades and the master of none but a little knowledge is a start and might become your foot in the door for a new career someday. It also makes you a big picture person who can relate to others.
So here is my conclusion:
Specialize in your career; generalize in your hobbies.