12 New Programming Languages to Learn
Ruby was Dillon Kearns’ first love, but now, there’s a new language in his life.
“Elm has really changed my perspective,” he said. “When I was working in Ruby, I’d see code that’s verbose and I’d be like: ‘Let’s clean this up. Let’s make it read more like English or like a domain language created for this task.’ Now when I look at Ruby, I realize those are the things that slowed me down.”
There’s a tradeoff between sleek code that’s implicit and wordy code that’s explicit. A younger version of Kearns enjoyed the challenge of keeping track of what’s happening behind the code. Then Elm came along, and his aesthetic evolved.
The functional programming concepts that power languages like Elm have been gaining popularity among developers — why worry about changing states when you can perform a clear-cut series of transformations, the thinking goes. Many developers stop at using a functional style in their current languages of choice. Kearns thinks they should take it a step further: Choose a language with functional constraints built right in. That way, you know exactly what you’re going to get.
“If you’re working within the constraint, why not get the guarantee?” he asked. “You don’t have to think about those caveats: What about the possibility that this happens? There is no possibility.”
“Even if an experiment is a failure and you decide not to use the language you tried, it makes you look at things a different way.”
A long-time Python enthusiast, Grove senior developer David Rogers is also in favor of explicit code — it’s part of the Zen of Python, after all. But Elm has yet to win him over.
“Abstractions are useful things for a reason. In Elm, I have to very explicitly declare everything. One of the advantages that people see in the web component languages like React is that I get a shorthand for that thing I want to do over and over again,” he said. “Elm is really young still, and the community is really small. So I feel certain that eventually we’ll have more robust choices inside of Elm for component libraries.”
In the meantime, Rogers is learning Pony, an open-source, object-oriented language that uses actors, precursors to objects that Smalltalk popularized in the late ’80s. It also has a functionality called reference capabilities: “When you create a piece of data, you have to declare what other pieces of the code can or cannot see, and what other pieces of the code can or cannot do to that piece of data,” he explained.
Rogers is a dedicated programming polyglot, nicknamer of coding languages and author of this Quora answer that made me laugh. He wouldn’t go so far as to call functional programming a fad — perhaps a trend, he said. But, no matter the paradigm, learning new languages is a good use of time.
On this, Kearns and Rogers agreed. Even if Elm isn’t your bag, Kearns said, experimenting with new languages helps programmers get better at coding in their old favorites too.
“Even if an experiment is a failure and you decide not to use the language you tried, it makes you look at things a different way or leads you down a path where you learn about something else,” he added.
12 New Programming Languages to Learn
- Python 3
“There was this subset of the Ruby community that wandered down the Erlang rabbit hole, and they came out with Elixir,” Rogers said.
Elixir, however, is easier to write than Erlang, with the functional programming concepts of a language like Haskell. Elixir runs on the Erland virtual machine, which works well for low-latency distributed systems. The platform prioritizes scalability and fault tolerance. Lightweight threads of events, or processes, send messages to each other. Those processes can run concurrently, maximizing machine resources and making it easier to scale vertically or horizontally. If something goes wrong, the platform shows the developer the last known state that’s sure to work.
Elm is a functional language for building web applications. It works well for problems that involve a lot of domain-specific rules, like complicated user interfaces, because the developer can model those rules right in the program through Elm’s fast and expressive type system, Kearns said.
Other Elm advantages: The type system is constrained so that invalid data can’t be expressed. That means developers spend less time thinking about potential edge cases. Elm is also known for having no runtime exceptions. Programmers have to tell the program what it should do if the data they defined isn’t present or valid. If anything is missing or broken, the compiler helps developers identify the chunk of code that caused the problem.
“Elm was designed to be 100 percent typesafe. It’s not 90 percent typesafe,” Kearns said. “I think that that’s what really frustrates people with Elm when they’re considering using it professionally. But it’s also what makes people fall in love with it.”
(For more information on Elm, check out Kearns’ podcast, Elm Radio.)
Go is a C-style language created by engineering leads at Google. Sleeker than C++ or Java and more typesafe than Ruby or Python, Go comes with benefits and drawbacks.
Some drawbacks: Typing is strict. You can’t mix signed and unsigned integers, or integer sizes. Go also has some noticeable omissions: There are no generics and no inheritance. And if curly braces instead of parentheses makes your blood boil — walk away now.
But Go’s simplicity creates some marked advantages. Namely, the language is easy to use. There’s less hiding behind the written code, and the lack of inheritance helps developers avoid webs of dependencies. Tight definitions and thread safety seem to be Go priorities, Rogers said.
Dart is good for building user interfaces with event-driven code. The hot reload command lets developers see changes to their applications instantaneously.
Some other Dart advantages, according to one Dart team member: optional static types, minimal compile-time errors and a strong, built-in editor.
Reference capabilities compel the programmer to label pieces of data as mutable, immutable or isolated. If data is mutable, the compiler doesn’t allow the programmer to exchange the data between actors — when two actors access mutable data at the same time, they may make contradictory updates, or the data could get corrupted. Reference capabilities keep data safe and eliminate the need for locks to prevent concurrent data updates. With no locks, concurrent programs run faster.
Down-sides to Pony are low API stability, few high-quality third-party libraries and limited native tooling.
For Java users, TypeScript may look especially familiar.
“If you’re glancing at TypeScript — or looking at Angular code, which is all written in TypeScript — the code reads like Java 8. It just needed some annotations and some types, and look! It’s Java,” Rogers said.
And a Little of Everything
Kotlin is a faster, sleeker version of Java that runs in the Java Virtual Machine. It’s now the preferred language for Android development. According to Android’s developer site, its programmers switched to a Kotlin-first approach because the language comes with less boilerplate code, fewer null pointer exceptions and interoperability with Java.
Kotlin is useful for applications that run on both iOS and Android, programs that don’t use additional runtime or virtual machines, and server-side applications.
“These newer languages like Nim don't have as much penetration, but it’s nice to see the diversity across the field,” Rogers said. “And they’re all converging around type safety, which is nice.”
One of the older languages on this list, OCaml is a multi-paradigm language — it’s functional, imperative and typesafe, with an object-oriented layer.
Some OCaml strengths: It’s easy to define data types. All variables are immutable by default. APIs are stable with good backward compatibility for libraries. The language also offers automatic memory management and separate compilation for standalone applications.
Even if you’re fluent with Python 2, Python 3 will come with some surprises. It diverges significantly from the last version, Rogers said.
So, why make the switch? Python 3 has more intuitive code, with better type safety. The differences between binary code, Unicode and plain text are easier to parse. It also comes with new commands like asyncio, which cuts down on threading issues, and concurrent.futures, which launches parallel tasks.
Like OCaml, Reason is functional and immutable, but allows users to opt in to objects and mutation. Its type system covers every line of code and infers types when none are defined, with guaranteed type accuracy after compiling.
Like Go, Rust has C-style syntax (semicolons, anyone?). But unlike Go and C++, Rust has a memory-safety-focused “borrow checker” that makes sure any data being referenced still exists. This, along with assigning code to potential edge cases to please the compiler, can slow developers down.
But the language’s static typing and lack of garbage collection can also make things go faster.
Direct access to memory means programmers can write low-level code like operating system kernels. Rust is also a good fit for embedded devices, network services and command line editing. It’s won Stack Overflow’s most loved language for the last five years.