As explained on the previous page, most software is created using programming languages which use a mix of specific English words, punctuation, and ordering to express common patterns of instruction usage. They generally include variables, selection, repetition, and functions for describing actions, as well as some way of describing data. There are a very large number of programming languages; this page looks at just a few as a way of exploring why one might choose one language over another.
C Was invented by Dennis Ritchie in the 1970s so that he could use it to build an operating system1 The operating system he built with it, Unix, is the direct ancestor of every major operating system today except Windows and has been a strong influence on Windows too..
Some facts about C:
C only adds a few things that assembly and machine instructions lack: it allows any variable name instead of only a fixed set, lets you write looks and selection and functions directly instead of with a lot of jump to line
-type instructions, and helps you keep track of the type of each variable, meaning how the bits it stores should be interpreted.
Everything else – how to use memory, how to structure data, and so on – is left up to the programmer.
Most medium- to large-scale programs written in the 1980s and 1990s were written in C.
Still today, most embedded systems, operating systems, and device drivers and many performance-critical applications are written at least in part in C.
Many other languages are directly derived from or inspired by C.
If you see code that has braces2 Sometimes braces are called curly braces
because people often have low comprehension of the difference between braces {}, brackets [], and parentheses (). in it ({ and }), it’s probably descended from C.
C lets the programmer do anything… including things they really shouldn’t do. There are so many things they shouldn’t do, it is hard to write C that doesn’t do something wrong.
The lack of safety in C is one of the major drivers of the development and adoption of Rust, a broadly C-like language that is much safer than C.
Java was invented by James Gosling in the 1990s. He wanted something kind of like C++ but that could create programs that would run safely on any computer.
Some facts about Java:
Java is designed to be compiled, meaning there is a program (a Java compiler) that converts the Java source code into a much simpler language that’s kind of like machine instructions. That simpler code is interpreted, meaning it is input into a program (the Java Virtual Machine) that uses a few machine instructions to do the thing that each simpler-code instruction wants to have done.
This split design makes Java slower than C to run, but much easier to share between machines.
object orientationor OO. OO was rising in popularity in the 1990s and is embedded into Java’s design: it is hard to write non-OO code in Java.
Python was invented by Guido Van Rossum in the 1980s as a side project because he could and named after his favorite comedy troupe, Monty Python. He declared himself the languages’ Benevolent Dictator for Life
(a post he has since resigned), included jokes all through the language’s documentation, urged people to think of the language as fun, wrote pithy sayings about how to write pythonic
code, and generally didn’t treat things too seriously.
Some facts about Python:
Python makes up for being slow itself by letting most of the hard work be handled by libraries, meaning supporting code written by other people, that are mostly written in C. It is sometimes referred to as a glue language
where it’s primary job is to hold other code together.
This glue-like role helps Python be readable: the complicated computations generally happen behind the scenes in some C-language library that Python programmers only see as a few simple function calls.
R was invented by Ross Ihaka and Robert Gentleman in the 1990s as a free copy of S they could use in teaching students. S was invented by a team at Bell Labs in the 1970s to be an intuitive interface over functions written in Fortran. Fortran was one of the very first programming languages ever.
Some facts about R:
Originally, R was a thin wrapper around a group of standard functions all of which were implemented in Fortran. Over time, more R-native code has been added, but it remains the case that many of its core operations are sent to Fortran routines.
The difference between wrapper and glue is not a crisp one, but sometimes implies that glue starts with what the programmer will write in the interpreted language and then figures out the compiled library to make that work, while wrappers start with what the compiled library does and then figures out how to expose that to the user.
How much do you trust your users to never be malicious?
If you expect a malicious user could get access to your software3 This always includes any software with a web interface of any kind, even just for infrequent tasks like downloading updates; and any software with elevated privileges (anything that would ask for an administrator password while running). Only the smallest, simplest programs don’t fit in this group., pick a safer language like Rust or Java, not an unsafe one like C or C++.
How important is it that new programmers understand the software?
If you expect to bring on new people or maintain the software for many years, pick a popular language (like those listed above) instead of a more niche language, no matter how much better the niche language might be for the task at hand.
Do you have existing code you want to be able to keep using?
Note that this is not always as worth doing as it seems; rebuilding software takes less time and money than building the original version did and often results in cleaner, more efficient, easier to update programs.
But if you do choose to keep old code and add new code to it, the interoperability of the old and new language is important to consider. It’s also somewhat nuanced, more so than we can explore on this page.
How much do you value programmer productivity versus software efficiency?
Productivity suggests picking a high-level language with clear syntax, like Python.
Efficiency suggests picking a low-level language with tunable performance, like C.
How large do you expect the program to grow?
Small programs are easier to write and update in simple-looking languages, like Python.
Large programs are easier to organize and manage in highly-structured languages, like Java.
What domains do you expect your program to utilize?
If the answer is just one, there may be a domain-specific language like R that would be helpful.
If the answer spans several, it’s probably best to pick a general-purpose language like Python, Java, or C.
What platform will run your software?
Some platforms only support a few languages; for example, web browsers only run JavaScript and WebAssembly.
Resource-constrained platforms like low-energy emebeded systems generally require a language where you have detailed control over memory usage, like C.
Software that needs to run on several different platforms can benefit from a partially- or fully-interpreted language like Java or Python.