Programming Languages
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
A system programming language usually refers to a programming language used for system programming; such languages are designed for writing system software, which usually requires different development approaches when compared with application software. System software is computer software designed to operate and control the computer hardware, and to provide a platform for running application software.
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
- C++: every 3 years, C++11, 14, 17, 20, 23.
- Java: LTE version release every 2 years after Java 17.
- Rust: new
edition
every 2 or 3 years, with chagnes that break compatibilities.https://doc.rust-lang.org/stable/edition-guide/editions/index.html
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.
- TIOBE: update monthly, based on the number of web pages.
- PYPL: update monthly, number of searches for tutorial of each programming language. https://pypl.github.io/PYPL.html
- RedMonk: update twice a year, based on GitHub and StackOverflow
- Github's stats: Octoverse
- Google Trends.
- Githut: https://madnight.github.io/githut
- StackOverflow Survey: https://insights.stackoverflow.com/survey
PPL: Probabilistic Programming Language
4th Generation Programming Language
https://en.wikipedia.org/wiki/Fourth-generation_programming_language
Domain-Specific Language (DSL)
Different from a General-Purpose Language (GPL), a DSL is for a specific problem. For example, CSS is just for styling web elements, SQL is for database queries, make for building programs.
Ruby, Scala, Groovy are especially good for building DSLs. E.g. Gremlin is a graph traversal language written in the Groovy.
HPC
High-performance computing (HPC) frameworks, such as OpenMP and OpenACC: provide application program interfaces (APIs) that programmers can use to express parallelism in code.
Trivially destructible
Informally this means that the destructor does not do anything, even taking member and base destructors into account. More formally it means that the type has no user-defined or virtual destructor and that all bases and non-static members are trivially destructible.
Foreign function interface (FFI)
A program written in one programming language can call routines or make use of services written in another.
Java
In Java, it is called JNI (Java Native Interface) or JNA (Java Native Access).
Java foreign function:
Go
https://go.dev/doc/faq#Do_Go_programs_link_with_Cpp_programs
Cgo enables the creation of Go packages that call C code. https://pkg.go.dev/cmd/cgo
String Templates
- java string template https://openjdk.org/jeps/459
- go template