Hacker News new | ask | show | jobs
by rohitarondekar 4966 days ago
The article doesn't actually provide any significant reasons as to why you need to be a polyglot programmer. If anybody is reading this I would love if somebody can provide reasons besides being able to think differently. I'd like to encourage programmers, at a ruby user group, to learn other programming languages. But besides the think differently I can't come up with any compelling reasons. Am I being silly? Is being able to think differently about problems the only reason to learn different programming languages?
6 comments

i think you can make the case that for many (largely self-educated) programmers, learning new languages is a good way to understand programming at a more abstract level. and that, in turn, means that you can write better code.

for example, if you understand an object-oriented and a functional language then you understand two quite different ways of encapsulating state - as objects and as closures. that leads you to thinking about state as something more general than either, which gives you a higher level view of the problems you are tackling.

so learning multiple languages illustrates different aspects of "deeper" issues in programming and motivates the discovery of those abstract concepts, which then provide a stronger "mental toolbox" to do your work.

from my own work, for example, i feel that google's guava library has improved my java code considerably. using that library well requires (i believe) an understanding of the advantages and disadvantages of both oo and fp programming.

> if you understand an object-oriented and a functional language then you understand two quite different ways of encapsulating state - as objects and as closures. that leads you to thinking about state as something more general than either, which gives you a higher level view of the problems you are tackling.

Yet, it may not be general enough. With one data point, one doesn't generalize. With two, one tends to think of a spectrum. With three… Now it gets interesting.

For instance, encapsulating state: you had objects and closures. They look pretty different, until you learn of Functional Reactive Programming, where state is handled in a much more timeless fashion.

Thinking differently is the big one, but not the only one. There are places where one language has tangible advantages over another. Knowing more languages helps with the "When all you have is a hammer" problem.

I will never use C++ to parse text files when I have Perl available. On the other hand, I shudder to think what most C++ software I've seen would look like in Perl.

Sometimes learning another language helps with understanding constructs in the languages you already know. I started seriously programming, after a 7 year break, with C#. I am self taught and it was going well. Then I got to lambdas and I got stuck. Later I started picking up F# and got more into functional programming. From using F# I became familiar with lambdas and anonymous functions and they started clicking with me in C#. That allowed me to expand my C# skills indirectly.
The next phase of being polyglot programmer is actually using multiple languages in the same project. This can result is astounding examples of using the right tool for the right job. ROS.org is an excellent framework for message passing between C++, Python, Java and lisp (and in my current project we also have custom bindings to a Prolog interpreter). In our project we use Prolog for classical reasoning, C++ for signal processing, and Python for a dynamic architecture. With an applied polygot programming style you get the execution speed of C++, the agility of python and domain specific features WHEN YOU NEED THEM
Agree about the article.

Learning other languages and thinking differently gives you entirely new ways to solve problems, and can't really be encouraged enough. Beyond that, there's the analogy of the carpenter. If someone working at a carpenter only has one tool (a hammer) how effective can they really be? They might be able to do beautiful work, but just think how much more they could do if they only had a saw.

I don't think you're being silly.

For me, learning a new programming language is an opportunity to see how different languages implement different features. For instance, JavaScript, lua and C# all have different ways of implementing inheritance. Understanding the pros/cons of prototypal inheritance vs. classical inheritance makes me a better developer.