Stay relevant in tech by being a learner, not a specialist
Being a learner is a choice you already made
When you joined the software industry, you made a deliberate or accidental decision to be a learner. Change, progress, and innovation are the goals of technology; not many fields change as quickly and relentlessly.
As of 2016, there were about 21 million professional software engineers in the world, 4 million of them in America. This large workforce pushes streams of change and innovation; keeping up with it can be daunting. I am here to tell you that you must stop worrying about being left behind, and start embracing change by becoming a non-dogmatic lifetime learner.
When I started coding, there were not many things you had to learn to land a software engineering job. C/C++ and robust CS fundamentals went a long way to prepare developers for tech careers.
In recent years, things changed. A new breed of tech giants started pumping out streams of open source technologies, including new languages, frameworks, libraries and entire integration systems. The trend is instrumental in pushing global progress and is creating the tools necessary to build products quickly. For engineers, it has some drawbacks, but it also opens many opportunities and has many advantages.
A disadvantage is an explosion of niche areas of specialization, and the need for developers to constantly keep up with a growing number of things they could be asked to know at the next job interview. Job ads often ask for experience with things like .NET, Spring, Rails, or whatever technology the company uses at that moment.
One of the advantages of this trend is that the ever-increasing availability of tools saves developers from having to write and re-write boilerplate code to resolve common problems. Developers today can focus on solving new challenges and can rely on existing and proven code to solve old ones.
Not as bad as you think
There is some truth in the danger of being left behind, but I also believe it is not as bad as many people think. There is a tendency for developers to fall in love with a particular tool or technology and specialize. You can use this trend to your advantage by avoiding it and focusing on becoming a fast learner. To be a fast learner, you need to develop a solid foundation, and you have to choose not to specialize. Avoid focusing too much energy on becoming a master of one particular framework.
An issue with engineers that specialized in one technology is that they will choose it blindly to resolve all problems, even problems that would be better served by using something else. For example, it might seem like a good idea for a Ruby on Rails expert to build micro-services using Ruby on Rails. It will sort of work with dubious initial success, but will not go very far. If you are one of those engineers, your specialization gets in your way clouding your judgment.
Be situational in your choices
Instead of specializing, focus on a strong foundation. If you are just starting, focus on CS fundamentals and software design patterns. Make sure to master one compiled and strongly typed language (Java is a good one), and one scripting language (Python is a good choice). If you have a few years of experience under your belt, make sure to continue improving your foundation, and use technologies situationally as tools, not as dogmas. Market yourself as someone who is adaptable, and not a guru in the use of one particular technology. Look at it as a financial investment. Would you invest all of your money in on one single stock?