14 Monkeys

Your choice of 14 major programming languages


The major programming languages all share several traits, including substantial ecosystems that make them quite versatile, large user communities that make hiring easier, and proven track records in real-world use.

They also have fundamental, intrinsic qualities that imbue them with unique strengths (and weaknesses). Here are my insights on 14 popular languages (as ranked by Redmonk).

A note about language choice

Different languages are preferred for different purposes, tastes, strengths, and philosophies.

  • A general-purpose language may satisfy most users, but there are instances where you may prefer a language that is more closely tailored to a particular problem domain.
  • Developers have varying tastes. Some prefer static languages, others prefer dynamic. Some prefer object-oriented (OO), others prefer functional or declarative.
  • Different languages have different strengths. I personally think Smalltalk is hands down the best for OO programming, but Lisp/Scheme may be the best for functional, and Go or Erlang/Elixir would be much better at concurrency.
  • Programming languages are also a religion. Some people swear by static languages, others can’t live without dynamic. Some believe that all of their favorite features should always be on tap, just in case, but this leads to complex languages such as D, Swift, and Vala.
  • Very often, language choice is dictated by existing software infrastructure — a Java shop may never switch platforms because the cost of change is too high .

Now, on to the languages…

JavaScript

The lingua franca of the web. It’s the one and only language that is native to web browsers, making it the common choice for front-end web development.

  • JavaScript has a remarkable user community that has created an impressive collection of tools and frameworks — in particular, Node.js. At the same time, the vast array of web frameworks, such as AngularJS, React, Ember.js, Backbone.js, Knockout.js, Meteor, Aurelia, etc., leads to “framework fatigue” and “analysis paralysis” for some.
  • JavaScript doesn’t have an integer data type. All numbers are floating point.
  • JavaScript doesn’t have a proper array type. JavaScript uses associative arrays to masquerade as other data types, including what we generally understand as an “array.” This is often comical.
  • JavaScript has weak typing and carefree automatic coercions. This flexibility leads to some “interesting” and bizarre behaviors.
  • JavaScript is very forgiving of syntactical errors. In fact, it can fail silently due to a syntactical error. For example, assignment to a nonwritable property, assignment to a getter-only property, or assignment to a new property on a non-extensible object will fail silently.
  • JavaScript has closures and lambdas, features commonly found in other languages such as Smalltalk, Ruby, Objective-C, C#, C++, and so on (Java 8 also has them). This is primarily what gives JavaScript its functional programming flavor.
  • JavaScript has OO in the form of object “prototypes,” a feature found in only two other well-known languages: Self and Lua. This is a very uncommon way to do OO.
  • ECMAScript 2015 has cobbled on “classes” as syntactic sugar over prototypes.

Java

The standard enterprise language. It is the fastest and most versatile of the managed languages, thanks to its highly optimized JVM.

  • The JVM is Java’s principal strength. It provides for application portability and platform independence. Plus you can build wholly new languages on top of it. Popular JVM languages besides Java include Scala, Groovy, and Clojure.
  • Java is used nearly everywhere: web, desktop, mobile, games, IoT, robotics, cloud computing, numerical computing, machine learning, etc.
  • Java is strongly OO in practical use. All functions must belong to a class.
  • Java has primitive types that are not OO. This is for performance reasons.
  • Java has a strong security model.
  • Java easily outperforms JavaScript and V8. In fact, the JVM is nearly as fast as C++!
  • Java 8 introduced lambdas and closures, giving the language functional capabilities.

PHP

The language that drives the majority of the world’s websites. Much of its continued success can be attributed to its ecosystem of modular CMSes: Wordpress and Drupal.

  • PHP is a preprocessor for HTML.
  • PHP is very easy to learn.
  • Like JavaScript, PHP has dynamic and weak typing.
  • PHP 7 made breaking changes to the language, thus improving the language significantly.
  • By its very nature, PHP lacks versatility outside of web development.
  • Facebook has contributed a lot to PHP performance with its HipHop virtual machine.

Python

The scripting language that can do nearly everything!

  • Along with Java and C++, Python is one of the most versatile programming languages in the world.
  • Python is very popular in the financial industry and for numerical/engineering computing, despite its reputation for being slow. Very little can trump ease of use given the speed of today’s hardware, but if maximum performance is critical, then C++ or Java can be used instead.
  • The syntax is indentation-sensitive, i.e., Python uses indentation (whitespace) to delineate blocks of code.
  • Indentation can easily throw you off if you mix spaces with tabs in the code. It can also play havoc with cut-and-paste.
  • Python is generally easy to learn. Many developers encourage first-time programmers to start with Python.
  • Python 3 made breaking changes to the language. Fortunately, Python 2 will continue to be supported until 2020.

C#

Largely Windows-centric, C# is starting to break out with Xamarin, Unity, and other platforms. Microsoft has gradually changed its stance toward open source over the last few years and has even open sourced the .NET platform on which C# runs.

  • C# shares much in common with Java. It was basically Microsoft’s response to Java.
  • C# improves on Java in many ways, including better generics (which you can perform reflection on), dynamic typing, and better syntax for Properties and Events. But it also makes C# a more complex language than Java.
  • C# allows C-like memory pointers in “unsafe” blocks.
  • C#’s exception handling is inferior to Java’s.
  • Normally Windows-centric, C# is finding use elsewhere, thanks to frameworks such as Unity and Xamarin.

C/C++

I’ve lumped these two languages together because of their tightly bound heritage. C is essentially a subset of C++.

  • C++ is the Swiss Army knife of programming languages. It can do it all, from hardware-level programming to complex engineering and financial models.
  • They both have extremely complex syntax. C++ has the more complex syntax.
  • C++ has highly optimized native code generation, but C’s code generation is slightly better.
  • C and C++ provide hardware access via memory pointers, which can be very dangerous.
  • C and C++ require manual memory management instead of garbage collection.
  • C is the language that underpins nearly all of IT. It’s used for writing OS kernels, device drivers, embedded software, etc. Most of the modern languages here were written in C (e.g., CPython, Ruby).

Ruby

Best known for web development with the Rails framework, Ruby is also a general-purpose programming language.

  • Ruby was designed to make programming as easy and pleasant as possible. Ruby is an amalgam of Perl, Smalltalk, Eiffel, Ada, and Lisp. As such, it’s both a functional and OO language.
  • Despite being heavily influenced by Smalltalk, which often invites comparison with this language, Ruby lacks Smalltalk’s image-based persistence and live programming environment, and the way blocks and closures work in Ruby is something of a hack compared to Smalltalk.
  • Ruby is also heavily influenced by Perl, which gives Ruby a great deal of its flavor.
  • Ruby is very closely associated with the Rails web framework, almost making it a niche language.
  • Ruby is widely used for system administration as well. Puppet and Chef — tools that supported the early DevOps and infrastructure-as-code concepts — both use Ruby-like syntax or DSLs to manage configurations.

Objective-C/Swift

I’ve lumped these two languages together because they’re heavily Apple-centric. Swift is Objective-C’s anointed successor.

  • Swift is syntactically very similar to Scala.
  • Swift compiles to native code, just as Objective-C does.
  • For memory management, both languages use automatic reference counting (ARC) instead of garbage collection. This has its advantages, but ARC will slow down your program overall.
  • Objective-C is a cross between C and Smalltalk. It’s an awkward marriage, but it works.
  • Despite its Smalltalk heritage, Objective-C lacks Smalltalk’s live coding environment.

R

The golden child of data science.

  • R is a Domain-Specific Language that is very specific to statistics.
  • Everything in R is a vector; there are no scalars.
  • R is very powerful at matrix computations.
  • R is an interpreted and dynamically typed language. Unfortunately, it also has a very steep learning curve.
  • R is easily extensible. Thus, it has a vast array of statistical and graphical libraries.
  • R by itself is slow, mind-numbingly slow.
  • R can link to C++ and Fortran code for performance improvements.

Perl

Powerful scripting.

  • Perl is used for CGI scripting, graphics programming, system administration, network programming, data mining, and many other applications. It was once described as the “duct tape that holds the Internet together.”
  • It possesses unmatched regular expression and string parsing capabilities.
  • Perl has a remarkable ecosystem in CPAN.
  • Reading and typing Perl code can be painful because of the wide variety of symbols used.
  • Perl 6 made breaking changes to the language, but it should be a much better language!

Scala

Scala is a JVM language designed as an improvement on Java both in terms of syntax and having a very strong static type system. It was also designed to have full support for functional programming.

  • It does away with Java’s verbosity and boilerplate code.
  • Scala lets you write very clean and concise code. The language is highly expressive.
  • As the name suggests, Scala is very scalable for large projects.
  • It is characterized by glacially long compile times, thanks to the language’s extreme complexity.
  • It offers many different ways to programmatically achieve the same thing. This can lead to code that is difficult to understand.
  • Its reliance on special symbols, especially in function names, can make code appear more cryptic. One interesting example is that there are nearly a dozen different uses for the underscore!
  • It behooves me to present a very important critique in this article.

Go

The little language that could. Go was built by Google and is heavily used for concurrent, server-side software, but it’s finding new uses everywhere. It’s already a Top 10 language on several rankings, and it’s only six years old!

  • Go is extremely succinct and is designed with minimalist syntax. Thus, it’s very easy to learn.
  • Go compiles at supersonic speeds, conferring upon the language a definite “dynamic” feel. And because it’s compiled, it has native execution performance that approaches that of C++.
  • Error-handling is done almost entirely via multiple return values from functions. This may seem old school, but it’s a safer and more reliable mechanism than exception handling.
  • A high-level exception mechanism is available for recovering from “panic” situations.
  • Go has superb concurrency support via “goroutines” and “channels.” It’s based on the theory of Communicating Sequential Processes (or CSP).
  • The interface is a core feature of Go. An interface is a data type that represents a set of methods. It’s a powerful new way of doing OO. Instead of designing abstractions in terms of what kinds of data our types can hold, you design abstractions in terms of what actions they can perform.

Haskell

The archetype of functional programming endowed with a sophisticated type system.

  • It’s a pure functional language with a steep learning curve.
  • Haskell defaults to lazy evaluation, which makes it hard to reason about execution order or figure out whether something is even executed! This can make conventional debugging techniques less useful.
  • You have to use monads for side effects such as I/O.
  • Haskell’s naming scope can be quite clumsy.
  • Haskell has very good concurrency support.

Clojure

The best Lisp around. You can find it on the JVM, as well as on the web (ClojureScript).

  • Clojure is homoiconic, i.e., code is data and data is code.
  • Clojure has a sophisticated macro system.
  • Clojure’s central data structure is the list, delineated by parentheses. The language is characterized by endless parentheses which can obscure readability. For example, code blocks are lost in a sea of parentheses, whereas in other languages they’re clearly delineated (begin…end in Pascal, {…} in C, […] in Smalltalk, and even indentation/whitespace in Python).
  • Clojure relies on prefix notation which is odd-looking for arithmetical and logical expressions.
  • Clojure has strong built-in concurrency support based on Software Transactional Memory (or STM).

Send us your thoughts

These tips are based on my experiences with these languages and other developers’ reviews of the languages. Share your own experiences in the comments and let us know if you have any thoughts contrary to these points.


Originally published at techbeacon.com.