Contenders

The list is taken from programming language rankings research by The RedMonk 2016 and includes the most popular general purpose languages:

JavaScript

Java

PHP

Python

C#

C++

Ruby

C

Objective-C

Perl

Scala

Go

Haskell

Swift

Clojure

Groovy

Visual Basic

The fact that those languages are so widespread and popular makes any of them fun and easy to learn and potentially very useful in a programmer’s career. The listed programming languages are general purpose and highly applicable on many platforms - desktop, server or mobile - to create anything from games to serious business systems.

It doesn’t mean that learning a rare esoteric language or a special-purpose language is not good as a second programming language; it can also be quite fun and useful. But for the moment let’s ignore them to avoid comparing oranges and apples as much as possible. For this reason things like CSS or Matlab are excluded.

This approach assumes that you are coming to this question with a free mind, because otherwise, if you have a clear goal or a type of software you want to create, you should follow other specific guides relevant for your task.

Classification

All the languages are divided into groups by several distinguishing features or attributes:

Strong typing vs duck typing

Virtual machine vs native execution

C-style syntax languages vs others

Functional vs imperative

Object oriented-ness (high vs low)

Modern vs old-school

Web-friendly vs others

The wikipedia page has many more of such categories. The ones that are picked here are chosen because they are mostly applicable to general purpose languages from the list above. For example “data-oriented languages” category is not included, because related programming languages like SQL are not in the list. The guiding principle here was that getting familiarity with some new language concepts should make you a better programmer in general across all knowledge domains and many programming languages.

In addition a category must divide the language set into 2 groups of similar size. Having uneven classes is bad, because such classes would be representing individual languages more than some generic feature. Learning a second programming language from any of 2 even groups saves time, because you become more familiar with the maximal number of the other similar languages from the group.

Strong typing vs duck typing

Strongly typed programming languages are the ones with static types, which are specified by a programmer and checked by the language compiler before program execution. For example when declaring a variable you normally specify a name and a type for it. This category includes Java and C-family languages and excludes languages like JavaScript, PHP or Python where a variable type is usually not known in advance.

Virtual machine vs native execution

Natively executed programming languages like C or C++ take source code and generate machine instructions which are well-known (“native”) to a target CPU (“real” machine), whereas some other languages like JavaScript, Java or PHP generate some intermediate instructions and require a virtual machine or an interpreter to run them on the CPU. Native languages could facilitate learning of the CPU architecture and assembly, while VM-based would typically have a smarter runtime, be more dynamic and flexible.

C-style syntax languages vs others

This group includes mostly “Curly-bracket languages” derived from the C language syntax where a code block is denoted by “{” and “}”. In addition they usually inherit more of the C-syntax like a typical C looping construct:

for (i = 0; i < n; i++) { ... }

The rest of the set includes “Off-side rule languages” like Python and other languages with different syntaxes, and your second programming language might be waiting there.

Functional vs imperative

Imperative programming languages are those where you specify a sequence of steps that should be executed in the given order to achieve some task. In contrast to that the functional approach defines a task as a set of equations which tie inputs and outputs, but lets the language figure out the steps to do. Most of the listed languages support both approaches to programming, but one of them, typically imperative, is usually predominant.

Object oriented-ness (high vs low)

Even though most of the listed languages claim support of object-oriented programming (OOP), some of them force using OOP more than the others. For example in Java all the code must be attached to objects or object classes, and the entire standard library is object-oriented. In some other programming languages it’s more natural to not use OOP unless strictly required.

Modern vs old-school

Modern are simply those which appeared in the last 10 years and became widely adopted and recognized in the last 5 years. The idea here is that newer programming languages bring in more diverse, trendy and crazy concepts while the legacy languages would mostly stick to the ones proven by time.

Web-friendly vs others

Web-friendly languages provide strong support for programming web applications. They support server-side web programming by having widely-used web frameworks or web foundation APIs. Although this is a domain-specific category, it divides the language list into almost equal parts. Thus being a web programmer it’s worth picking a second programming language from another half of the languages landscape (and vice versa). Being out of the “web-friendly” group is not bad, and most likely means that such a language is strong in some other software development areas.

Selection strategy

The more you learn during a period of time the better. Given a constrained amount of time for playing with, studying and mastering a second programming language of choice, wouldn’t it be better to maximize the amount of knowledge you get?

As a simple example, if you know a C-style language (such as C), the tool might suggest you to learn Python as a second programming language, because it doesn’t have C-style curly-bracket blocks among other things. Moreover it tries to find the languages that are most different in all the aspects from the one you already know.

Simply said, a language gets one point for each feature which is different from the same feature of the language you know. The tool calculates a hamming distance between the language you know and the others, and finds the ones which are most “far away”. The further a language is the less familiar you might be with its concepts and so it might be worthwhile to learn it.

Tool: second programming language advisor

Select a programming language you know

Results

The tool is not perfect, it’s an experiment. Feel free to leave a suggestion about modifications and improvements such as programming language additions, language feature additions or algorithm modifications.