logo

Programming Languages

Last Updated: 2023-03-24

Most likely you will use more than one programming language through your career. There's no single "best" programming language, each one has its own use cases, and languages are popular or unpopular for some reasons. Here's my summary:

C/C++ and System Languages

C/C++ are lower level languages, sometime called system languages, they are best for operating systems, drivers, game engines, machine learning algorithm implementations, or wherever performance is critical. However you need to take care of more low level details, like memory management, so it is error prone.

Newer languages like Go or Rust are trying to make it simpler for the programmer while achieving similar speed as C/C++.

Go was from Google, "for companies who have outgrown languages like Ruby, Python, and Node.js (v8) and have lost patience with the high deployment costs of JVM based languages."

Rust has more complex syntax and semantics (and presumably higher readability costs) in return for the maximum possible performance; low resources usage because it does not use garbage collectors; enforces memory safety, the compiler requires the program to be written in a specific way.

However C/C++ is still the cornerstone of the programming language world. As you may find from the rest of this list, most of the other languages are at least partially implemented by either C or C++.

Java and JVM Languages

Java is both wildly loved and hated. It is very popular in enterprises and also in mobile development, since it is the default language in Android. Kotlin is challenging Java as another officially supported Android language. Scala's popularity is mostly because of Apache Spark. Groovy is seen in Gradle, the build tool of Android. Closure is another JVM language that you may have heard of.

JVM is implemented in C++, and as of JDK 16, C++14 is used.

Python

Python is a versatile and beginner friendly language. The Python 2 to Python 3 migration took too long, and it somehow hurt the adoption and its popularity, but finally Python 2 was deprecated in 2020. Now Python is quickly gaining popularity due to the uprising of machine learning, or "data science". It is used in tools like numpy, pandas, Tensorflow, Pytorch/Caffe2, etc. It is competing with R in this area, however Python is also popular in other areas, like Django for web development, or scripts for automation.

CPython is the reference implementation, based on C.

JavaScript and Web Languages

JavaScript is totally different from Java, even though they share part of the name. It is the de facto language of the web. First only in browser, then Node ports it to back-end and React Native uses it for mobile. With the CSS-in-Javasript, it is even eating shares of CSS. However it is not a straight forward, or well designed language, you will struggle with it for quite some time until you figure out how to think in JavaScript. Microsoft's Typescript is beating Facebook's Flow to be the way of type checking. Google's Dart is being used in Flutter to challenge JavaScript in React Native.

The majority of the websites are powered by PHP. But don't be fooled. It is because WordPress is so popular for blogging, e-commerce, and content management, so smaller/long tail websites use it to skip the coding. PHP 7 got a big upgrade from PHP 5.x, but still I'm not convinced to invest my time in this language. Hack/HHVM is Facebook's version of PHP, but after PHP 5 is deprecated, HHVM would stop supporting PHP, and the two languages will diverge. Though open sourced, outside of Facebook, Hack's adoption is quite limited.

Companies are moving away from Ruby.

WebAssembly (or Wasm): A binary instruction format for stack-based virtual machine (browsers), intended to be faster to parse than asm.js. V8 is a JavaScript AND WebAssembly engine based on C++.

SQL

SQL is not the easiest language to write queries in many cases, however it is so widely used and supported, that's why in Hadoop system, Pig is dying but Hive and its successors/replacements are thriving, like Presto or SparkSQL. It is used in both online databases and data warehouses. SQL has its standards like SQL:2016, but no two engines are the same, each will implement a portion of the standard, and add some of its own features.

Implementations

Lang Impl Written In Source Code
Java OpenJDK C++ https://github.com/openjdk/jdk
Java GraalVM Java https://github.com/oracle/graal
Python CPython C https://github.com/python/cpython
JavaScript V8 / Node C++ https://github.com/v8/v8
Rust Rust https://github.com/rust-lang/rust
Ruby C https://github.com/ruby/ruby
Hack HHVM C++, Rust https://github.com/facebook/hhvm

Others

  • Object-C is being replaced by Swift; similar to Kotlin replacing Java in Android world. And Swift and Kotlin are similar: http://nilhcem.com/swift-is-like-kotlin/
  • C# and other .NET languages are only used in Windows; forget about Perl.
  • Lua - a powerful, lightweight and embeddable scripting language that’s incredibly fast. All Lua actions start from C code in the host program calling a function from the Lua library. Lua is good for run inside nginx, in Redis, in games
  • Fortran: a general-purpose, compiled imperative programming language that is especially suited to numeric computation and scientific computing.

Language vs Standard Libraries vs Other Libraries

New features / changes may be introduced at different levels:

  • Language specs
  • Standard libraries
  • Extension libraries
  • 3rd party libraries

Language Specs

The core specs to define a language, including keywords, syntax, etc.

Standard Libraries

Almost every language comes with a standard library.

Python has a large standard library. Mostly because it was born in the early 90s and Internet access was rare. Now there are many third-party libraries that are preferred to the standard library components, e.g. requests versus http.client, html5lib versus html.parser, etc.

Rust has a small standard library. Third-party libraries can be easily installed through Cargo.

Extension Libraries

Official libraries that extends beyond standard libraries.

  • Java: javax.

  • Kotlin: kotlinx.

  • Android: androidx / jetpack.

  • Go: golang.org/x (https://pkg.go.dev/golang.org/x), e.g.

    import "golang.org/x/sync/errgroup"
    
    g := new(errgroup.Group)
    

Release Cycles

Modules

It is interesting to see that major languages are adding the abstraction of "Modules", (to split code in logical units) though they may be designed and implemented in different ways.

C++20 introduces modules, a modern solution that turns C++ libraries and programs into components. An alternative to import header files. C++23 added module std.

In Go, modules were introduced in 1.11 and 1.12; Starting in Go 1.13, module mode will be the default for all development. A higher level abstraction of packages.

In Java, modules were introduced in Java 9

Rankings

If you disagree with my assessment, here are some places to check the popularity rankings of the programming languages. None is 100% accurate though.

Comparisons

C++ Rust Java Go JS Swift
GC NO NO YES YES YES NO
Runtime lib lib VM lib VM
class YES NO YES NO YES

Error handling

In C and similar languages, it is common for functions to return values like -1, null, or the empty string to signal errors or missing results. This is known as in-band error handling.

In C, a write error is signaled by a negative count with the error code secreted away in a volatile location. In Go, Write can return a count and an error.