They stick to what they know (usually C# or Typescript) and they have problems if they need to use a new tool or language.
They stick to what they know (usually C# or Typescript) and they have problems if they need to use a new tool or language.
Some of these people are in their 40s and are new to the industry. Not just picking in "younger" people here. Just a different attitude. I think the barrier of entry is just getting higher as we have to know a lot more these days.
We were in an EE/Telco degree where we had to program in different languages and configure plenty of different software, so knowing to solve that kind of problems are relevant in the kind of work they were going to do in the future.
The reality of that is how most of people are (or were?) in those degrees as a mere formality to get a good paying job, and interests are a secondary matter.
24 years ago, I had to do my computing A-level[0] in Visual Basic because that was the only language the teacher knew.
[0] UK thing: https://en.wikipedia.org/wiki/A-level
At least for juniors, I'm pretty sure the problem for a lot of them is they remember how much effort went into learning their first programming language and are assuming the second one will be just as much effort. They haven't realized how much of that effort went into general concepts that do translate to other languages, making it easier to learn more.
Programming languages have become ecosystems/biotopes. In this sense, learning another programming languages is about thinking how things are done in (often subtly) different ways in the other programming language, learning about the whole culture surrounding the other programming language, etc. There aren't so many transferable principles.
Because many programmers are not willing to put this effort into transferring into a different language, so much bad code is written by programmers who "never properly learned the way of thinking in this language/framework" and thus write, say, "idiomatic Java code" in C++ or "idiomatic Go code" in JavaScript.
All of these were new concepts to us at some point. I'm talking about people who are new enough to easily remember the effort that went into learning those basic concepts on top of learning the syntax for their first language.
Exactly my point: just to give some examples concerning your keywords:
- In many cases, for loops (with an index) became unidiomatic. Instead foreach or range-based loops became the idiomatic way
- In C#, for many cases, the idiomatic way is to use LINQ. The old style to write LINQ queries was to use query expressions, but it became out of fashion. Now, you typically use the method-based query syntax instead.
- conditionals: there actually do exist programmers who argue that if expressions are code smell when you do object-oriented programming (google "ifless programming" or "anti-if programming"), since the idiomatic way in (class-based) object-oriented programming when what should happen depends on some state is to write a method. This thought has not become mainstream, though. On the other hand: for a related reason in Smalltalk, a programming language that takes object-oriented programming much more seriously than most other languages, there exists no "if" as part of the language; see for example https://www.quora.com/If-if-is-an-object-in-Smalltalk-how-is...
- functions: functions now often have become stateful (coroutines, methods, polymethods, closures, ...). On the other side, there exist programmers (often from functional programming) who argue that functions as they exist in imperative languages are not "pure enough".
I was a teacher's assistant in introductory programming classes for several years in college and I assure you people new to programming do have to put in effort for all the basic things I listed above, not just functions.
Also, you don't need anything other than C++. >:D It's the one lang that can do it ALL! But not taking the time to learn C++11+ is demeritable.