top | item 17132256

Ask HN: Learning multiple languages vs. mastering one

157 points| trtobe | 7 years ago | reply

Hi All. I am struggling to find/understand the best path to improve my knowledge/skills. I have a decent knowledge/experience in Java and now I am facing the dilemma either mastering Java or looking to other options to extend my programming language tool set mainly looking at: Javascript/Python/Scala/Kotlin/Elixir/Haskell/Swift.

I am interested in distributed system/data engineering and also in finding easily new well payed job. I know it's not possible to learning and master them all in a short time so I would like to pick 2. What I am struggling the most is how well to evaluate the language and get the best from it. Each time I pick one I end up giving up after 2 weeks as I always go back to Java.

The way I evaluate is simply by going to project euler and go through the problems from 1 to 20 then I don't know the next step to take from there. I find myself going through the crazy articles comparing languages and lose focus and give up.

Would be appreciated if you can share how you manage to focus on learning a new language or if it's worth at all learning/moving to a new language.

Update: forgotten also to ask what language do you advice and in 1/2 sentences why. thank you

131 comments

order
[+] mjmdavis|7 years ago|reply
Programming Languages are just like Human Languages. Every culture builds a common form of expressing ideas based around their shared values, needs and outlook.

Restricting yourself to one Human language limits your thinking and perspective. Each time I acquire a new Human Language, I find myself thinking differently and understanding people more deeply. Speaking French and German allows me to be a better communicator in English.

Human Languages can also provide means to an end. Learning German allows me to become a German Citizen. Learning Mandarin would allow me to start a business in China.

The same goes for Programming Languages. As mentioned by others, different Programming Languages were developed by people with different values, needs and outlook. Each time I learn a new Programming Language, I learn new forms of expression for my problem.

Programming Languages allow you to do different things. Depending on what you want to do with your career, choose differently.

Some languages are more useful than others. If you only know Java then you have a lot of learning ahead. I would explore in this order:

  * Python - You can do almost everything well in Python. Make lots of stuff  
  * Command Line & Bash - How systems are glued together. Deploy the stuff you make.  
  * GNU Regex & awk - How to find things and process text. A key building block of programming is processing text.  
  * HTML5 & Javascript - The right way to make most visuals. A frontend for your stuff.  
  * C - How all the above works underneath. Understand the stuff you made.  
  * SQL - How to handle data in databases. Persist the stuff.  
  * Haskell - Pure functional programming. Your Python and JS code will improve. Make the stuff beautiful.
[+] igolden|7 years ago|reply
This is a great answer to a question we all face in our programming careers - what do I learn next? With an understanding of all of the items you mentioned, the OP will be a much more well rounded, valuable programmer. At that point finding a better job will just be a matter of showing people what he/she knows.

The hard part is knowing _how_ to measure your skills. A while back I came across an article called the "Programmer Competency Matrix" and it stuck with me (google it for reference). Essentially it's a table of CS/programming skills with measurements 0-3, and it gives the reader a way to measure/track their various competencies.

After I read that article, I took his matrix and added my own additional rows/columns that I'd like to be proficient at. To the OP - I suggest doing something similar. Write out a list of all of the programming skills/languages you'd like to have (and need to advance your career), and give yourself an honest rating. Ask a programmer friend to rate you as well. Then ask yourself - what 0's do you want to turn into 3's, and weigh that against your career choices. Then plan your learning accordingly.

Like mjmdavis said: programming langs are a means to an end.Making a choice on where to move forward isn't just about your career - it's emotional/artistic/personal. You don't want to choose a language you hate just for a paycheck. I find that being more self aware (with my matrix) has helped me learn the skills I needed faster and more intentionally.

Good Luck!

[+] indescions_2018|7 years ago|reply
It's inevitable you will have multiple languages / platforms comprising your stack. Bash scripts for admin. Golang to write servers. Data science in Python. JS / D3 on the frontend. C# / Unity 3D modelling and scripting. Even low level C / Assembly if you need performance optimizations.

I think mastery of cloud development and deployment is crucial going forward. Start experimenting locally right on your laptop with minikube, microk8s, snaps, prometheus. And get a sense of designing scalable systems.

You should have the ability to immediately estimate project costs. So you can give potential stakeholders a ballpark figure to open negotiations. Billion item recommendation system running on spark that serves 100K+ requests per second deployed to 1000 node cluster. Will it cost under $100 per hour? Or do we jump to tensorflow and a few large gpu instances for half that. Once you gain sufficient mastery. It will become second nature. And you can concentrate on design and building.

Best of luck :)

[+] lmm|7 years ago|reply
> It's inevitable you will have multiple languages / platforms comprising your stack. Bash scripts for admin. Golang to write servers. Data science in Python. JS / D3 on the frontend. C# / Unity 3D modelling and scripting. Even low level C / Assembly if you need performance optimizations.

It's not at all inevitable. I would - indeed do - use Scala for all of the use cases you listed.

[+] chrisweekly|7 years ago|reply
Go "T-shaped". In other words, be a "jack of [some] trades, master of [a few]".

Specifically, you almost have to choose modern JavaScript -- because you will need it on virtually any real project (it's everywhere), and you've already got the enterprise-y server-side covered. Don't get pigeonholed into backend-only, non-JS roles. Despite all the haters, es6+ is powerful and expressive.

You'll want to suppress your OO habits though, and embrace FP as much as possible.

Maybe get there by way of ClojureScript if you're up for it. Good luck! Have fun!

[+] aldanor|7 years ago|reply
> virtually any real project (it's everywhere)

That's a bit of an overestimation to say the least. E.g., I work at a trading firm and we use all kinds of languages for all kinds of purposes on all kinds of weird platforms, but JS is not one of them (I don't think we use Java much either, because why would you, this day and age).

'Any real web project' would be more correct. Not everyone cares about web projects though (same as not everyone cares about non-web projects, as you've pointed out).

[+] PaulRobinson|7 years ago|reply
T-shaped is excellent advice but there is something to be said for “paint drip shaped” skills too: imagine a thick line of white paint on a wall and how it drips down unevenly. Some of the drips/skills are very long, some are short, and most of the paint is that wide beam.

In relation to the OP then, being a master of an area is valuable, but so is knowledge of a few others in some depth and a lot of other areas at a much shallower depth.

[+] mattnewport|7 years ago|reply
No doubt JavaScript is useful but I've been a professional game developer turned VR developer for 18 years without ever needing it in my career. I have friends who went into embedded development who are even less likely to need it.

I could get by just fine professionally knowing C++ and later C# plus a bit of assembly (more so in the past) along with HLSL/Cg for graphics programming. The other languages I've learned have been for my own interest / education and that's included only a very minimal amount of JavaScript.

[+] anon1253|7 years ago|reply
I would sort of do a hobby project in the following languages (in addition to Java for Object Oriented Programming, although something obscure like Smalltalk can be fun for an evening):

- Haskell, functional programming with static types

- Clojure (or Common Lisp), functional programming in a dynamic language (and understanding the AST-as-syntax-homoiconicity)

- C/C++, "low-level" programming (e.g. pointers, memory management, registers, the basics of compilers)

- Prolog, Logic Programming as a completely different paradigm

Then after you've "grokked" the pros and cons of these languages, pick one language to become good at. It doesn't matter if that is Java, Java is a fine language; but being exposed to different paradigms broadens your horizon in my experience, and sometimes the idioms and ideas are portable. Personally I've done a lot of back and forth between Java, Python, Clojure and R . If the choice is mine I usually pick Clojure, but not always. Statistics and datascience I still do in R or Python just because the sheer amount of documentation and libraries available. I guess I've been influenced too much by Rich Hickey but he asks "would you rather become good at programming or at problem solving?", and for me it's the latter. Language paradigms help you to recast problems onto a different frame of mind, but at the end of the day it's your ability to help further a cause/business/idea that counts. Just my 2 cents!

[+] jerrre|7 years ago|reply
Could you give some examples of projects for which each of those language (types) are useful. Because I think it is important to choose a language fitting with the problem (or the other way around if it's exercise)
[+] oneplane|7 years ago|reply
On a diffrent topic, I wrote a bit on depth vs. breadth (but it was more of a book topic than language): https://news.ycombinator.com/item?id=17128854

For programming languages it boils down to: know the abstract stuff across most/many languages, but drill down on a small amount of languages/frameworks to be more productive.

I'd say: get to know Java and Python in-depth, select a few frameworks to know well (as languages by itself aren't the most useful thing when you are developing complete applications without reinventing the wheel). Java and Python have the advantage of a rich legacy, long term development, good cross-platform availability and broad support.

If you are specialising in the direction of high-efficiency or platform-specificity, I'd suggest Java + Elixir or Java + Swift.

I'd regard Scala and Kotlin as "Java-alternatives" for when you want to do Java without doing Java. Same goes for Groovy (and Grails framework). It's not a bad thing but doesn't automatically yield better results or gets you better understanding.

Keep in mind that languages by themselves are only useful if you have a supporting framework and knowledge of abstract programming concepts (which are language-agnostic).

[+] vorg|7 years ago|reply
When you want to "do Java without doing Java", it's good to use alternatives that have some present or like future adoption, such as Scala and Kotlin. You won't get that with Apache Groovy and Grails -- virtually no-one's upgraded to Grails 3 or started new projects in it, and the Grails 2 plugin ecosystem has almost died.
[+] pyrale|7 years ago|reply
I suggest Elm into Haskell.

Elm will give you the ability to do frontend work while familiarizing yourself with functional programming concepts.

Once you're OK with Elm, go to Haskell, which is a great language to get exposed to plenty of radically new programming concepts.

Once you have done that, and considering you have experience in Java, you will have a much broader view of abstraction thinking.

[+] danpalmer|7 years ago|reply
Just to back this up, I found Elm to be a really good way to learn Haskell. I actually started with Haskell, but Elm allowed me to practice a lot of my functional programming skills and the different way of thinking without getting in my way too much, and in a fun environment with immediate feedback (frontend development). When I went back to Haskell I found it much easier.
[+] icc97|7 years ago|reply
I don't see how you can learn Elm without knowing the basics of Haskell.
[+] tsmarsh|7 years ago|reply
What makes you think it's even possible to master a single language without learning others?

My experience tells me that monoglots reach false maxima because there experience isn't broad enough to realize that there are other maxima to climb.

Java is still, probably, my strongest language, but I strongly believe my craft would have stagnated around Spring/Hibernate if I hadn't taken the time to figure out how problems like typing, dependency injection, persistence, IO etc all work in other ecosystems.

Pick a language that is good for the market place you care most about. Mobile go with C or Swift. Science probably python. JavaScript if you like the web and if you like the perks of working in an Enterprise Java won't hurt.

[+] tharidlynn|7 years ago|reply
If you are interested in big data/data engineering, I would recommend you to learn python and scala. These 2 languages have been used in everywhere for data engineer world. For instance, Kafka was written in scala/java. Spark was also developed in scala language.

For python, it will increase your productivity in a lot of things such as etl/some scripts and also be very helpful to access various libraries for dealing with data such as numpy/pandas.

In my opinion, the best way to learn these languages is to tackle some problems. You can just start by scraping some data, inject them into distributed messages/logs system like kafka/rabbitmq ,transform them by using some tools like spark,and process them and store into some places that you want such as hdfs/postgresql/cassandra/s3.

[+] scarface74|7 years ago|reply
If your primary focus is to get a job,focus on languages, frameworks that are in demand.

If you already know Java, stick with it and learn an MVC framework to create APIs (I'm not a Java guy).

Learn HTML+CSS+JavaScript and then one UI Framework like Bootstrap and one SPA Framework (React or Angular).

Learn at least one RDMS - Postgres or MySQL they are the most popular open sourced RDMS

Learn Python. It seems to be the go to scripting language for data science and....

Learn about cloud infrastructure - preferable AWS since it's the most popular. You're going to have to host what you're doing somewhere. Opinions differ, some would say just to host on something like Linode, much cheaper and simpler.

[+] lmm|7 years ago|reply
Do a real project - making a tool someone (possibly you) actually wants to use - in the language. That's the only way to genuinely learn/evaluate.

For Scala (and I guess also Kotlin and to a certain extent Python), you have the advantage of easy JVM interop, so you can use them in an existing Java project. That's how I learned Scala (which I'd recommend): start by writing just a couple of classes (a small helper application with a main() where I wanted to invoke some of my existing Java code), start by writing very Java-like code, and then gradually work your way up. Don't try to force the fancy techniques before you have the problems they solve and can understand what they're good for. It took probably 2 years before I wrote any code that used (generic) monads, another year before I used any monad transformers, another year before I wanted to use final tagless...

[+] onion2k|7 years ago|reply
In my experience learning other languages makes you better at the ones you already know. You get exposure to different ideas, paradigms, and tools that you can bring back to your main language. For that reason I'd suggest looking at others.
[+] OskarS|7 years ago|reply
I agree, especially if the other language uses markedly different paradigms. Like, if you already know Java, learning C# is not going to massively expand your horizons, the languages are too similar.

Instead, you should try something like a functional language (like Haskell or a Lisp variant), or a dynamically typed language (like Python), or a language with a different memory management model (like C, C++ or Rust). It will give you practical skills and expand your horizons on how to solve problems with programming.

[+] lunch|7 years ago|reply
I'd recommend learning a few, here's my 2 cents:

- Start with Python, it's a very common dynamic language in the wild.

- From Python it's easy to learn Go and you'll want some Go experience if you want to work on distributed systems in today's culture.

- Javascript is another extremely useful one to know that you'll find everywhere, start with the book "Javascript the good parts".

Adding these in addition to your Java base would make you very well rounded, IMO.

In my 5-6 years of professional experience (startups and enterprise, full stack to infrastructure) I've never encountered Kotlin/Elixir/Haskell/Swift.

[+] amorphid|7 years ago|reply
If you learned Elixir, it would not surprise me if you started to prefer Elixir for most backend projects.
[+] paulmooreparks|7 years ago|reply
Learning new languages teaches you new ways to approach problems. For example, Java is pretty much locked into OOP, but LISP, JavaScript, Haskell, C, and C++ offer different paradigms and different ways of approaching a given problem. Even when you go back to Java, having these experiences will give you a deeper toolbox when you face a new programming problem.
[+] Chyzwar|7 years ago|reply
You should focus on two things:

1. Your "personality"

Properties/qualities that you like most. To discover what you really like you need to try different things. It might change over time as you become more experienced.

  - dynamic vs static
  - weakly vs strongly
  - oop vs functional
2. Impact and market.

You need to specialize in things that let you make the most impact. At some point, knowing specific APIs/Frameworks is more important for productivity. You also want to get nicely paying job and these will only come when you are expert.

  - frontend vs backend 
  - DevOps vs dev vs dba vs full-stack
  - networking vs distributed vs graphics vs web vs embeded
I would avoid Project Euler as problems are too small to evaluate anything other than syntax. Learning stuff like Kube or AWS is not particularly useful. Knowing what tool to use and how to put it together is more important.

Finally depends what you choose you might end up learning one language or multiple.

[+] biston7|7 years ago|reply
You should learn C. Most current engineers don't, and therefore the fundamentals of things like memory allocation, data types, call stacks, etc. remain a mystery to them.

I have one other comment to make. In my opinion, being a strong programmer is mostly a "knack," meaning it's not a particularly teachable skill. Some people are just amazingly good at it. If you are, great. If not, I suggest acknowledging that and fashioning a career that doesn't rely primarily on programming skills.

[+] mywittyname|7 years ago|reply
I'll throw out my $0.02, which is C is a terrible language to learn. Much of writing "good" C revolves around knowing all the pitfalls to check for, then dealing with the archaic error handling mechanisms. Tomes have been written on the subject of proper error handing in C.

> fundamentals of things like memory allocation, data types, call stacks, etc. remain a mystery to them.

I don't think C is especially good at teaching these.

Unless you roll your own malloc, the big difference in memory allocation in C vs. say, Java is that C requires the programmer free memory after allocation on the heap. This is more tedious than difficult.

Data types exist in other languages. You can unpack raw bytes of data using Java and simulate the behavior or unions.

You'll have to explain how call stacks are more exposed in C. Best I can think is calling conventions, but that's more the domain of compilers than language. Buffer overflow prevention, maybe (but again, I think that's more tedium to deal with).

C is great because it's a small language. But I don't think it's an especially educational language.

[+] galfarragem|7 years ago|reply
Noob question: Is there room for below average programmers? If so, where?
[+] mark_l_watson|7 years ago|reply
I have written books using a variety of languages that I also have used in work projects. I enjoy variety.

However, as a practical matter, learning just Java and Python really well will cover most areas of software development.

My personal preferences: I prefer Ruby over Python as a scripting language, but I am forced to use Python in my machine learning job.

I have used Common Lisp since about 1984, love it, and I am fortunate to get to occasionally still use it.

I like Haskell, but I am a ‘forever student’ and use a subset of the language that I understand.

EDIT: some knowledge of JavaScript is also recommended

[+] ekr|7 years ago|reply
> However, as a practical matter, learning just Java and Python really well will cover most areas of software development.

I disagree, given that both are interpreted languages, that excludes (practically) most embedded, low-level, high-performance software. Sure, you can use stuff like micropython, but it is not as practical as C is in that domain.

[+] NVRM|7 years ago|reply
Don't overlook at any books or tutorials from now. Go to the php docs alone. See stackoverflow for special queries only if stuck. Like any langs, start with low objectives. First try to do some maths, display the results. Then work with texts, try to alter contents by program. String, array, object, learn to create, and alter them. Later see by youself what kind of database type suits well your objectives. play with it (Flat files? json?). Wow you can pass external arguments by the url. (Big moment here ;) )

From there start to play with the internet, load remote datas, parse them, put them to your database. Then melt this all. Learn bash php scripting and unix, start to make system calls (exec, system, passthru...) enjoy the speed. Learn conditions (With just if you can do everything...seriously), Learn looping(while, foreach) , exit conditions and timing. Try to recreate basics tools: grep, cut, head, tail, cat.. you will see it is fairly doable and very funny to do.

Get bored? Do some javascript!

You will see personal ideas flowering at high rate. Still keep your objectives as low as you can. Small projects all aside.

Now you have all this in mind, open a book, check other sources code.

Learn security a bit. (Or not it all depends to your objective). Check good practices.

Close the books. Cut the Internet.

Get over this fancy libraries that anyone advise.

Open your editor. You are the internet. Have fun. ;)

[+] Blackstone4|7 years ago|reply
I used to be a Java dev (6 years ago)...

Over the last year I've been learning JavaScript + React (frontend) and TypeScript + Node.js (backend) for a side project. At times it's great because you can cobble together all these small modules to build something really quickly and other times.... everything gets updating so often and apis change.....oh I'm going to create a new project.... xyz module needs dependency abc...blablabla.

Also JS on the server is synchronous which is not natural for me to write it. I end up using async/await everywhere except for a few places.

So I've been thinking about to concentrating on a more stable eco-system so I can really master it. With that in mind, I've started learning Golang. Great if you're interested in web servers and distributed systems. It makes concurrency easy and it runs fast. Check out this post: https://grisha.org/blog/2017/04/27/simplistic-go-web-app/

For data you could use Python (#1) but I understand Golang is also a respectable in this arena but probably not the best.

[+] Isofarro|7 years ago|reply
Don't learn a new language for the sake of learning a new language. Learn it because it solves a particular problem better than your existing skill set.

For example Node.js is good for tiny Web Services/API endpoints using an event-based model. Elixir for writing highly concurrent systems.

Sure, both of these can be done with Java -- since it's a general purpose language, but the result with more focused languages is a more succinct solution.

[+] EnderMB|7 years ago|reply
I've made this transition over the last few months.

For the past eight years, aside from dabbling on my own, I've been a .NET developer. I've worked in startups, agencies, and good-sized companies, and have delivered more projects than I can count. I've also given talks at user groups, and have delivered open-source tools. I wasn't an expert, but I'd say that I knew C# and .NET reasonably well.

However, I always felt a bit of imposter syndrome. While the .NET world is more open than ever, you still feel like you're an apple in an orange-infested world. Literally everyone else builds on Mac/Linux, and while the tools differ between languages a PHP developer would have more in common with a Python developer than they would with a .NET developer.

So, I left a senior role and took a standard dev role in a software house with zero .NET tooling, and have forced myself to learn different languages in anger, instead of restricting myself to only learning in my free time.

It's been hard, but I feel like I'm learning loads every day. I've also learned things I would've probably ignored if I was doing this in my free time, like Ruby and Rails. I still feel like an idiot most days, but I'm hoping that in the next few years I'll go from being a solid C¢ developer to a solid developer, and that alone will go a long way towards getting over that imposter hump.

So, my advice is to try and learn what you can on your own, but if you feel that you are better served by working with this tools "in anger" or around a team that really knows its tools then look for a job that both allows you to do this. Once you reach a point where you're comfortable in a language, move to something new, but keep that language to your free time.