Choosing your future tech stack: Clojure vs Elixir vs Go

Programming is a fashion industry. As developers, we have to keep on top of the trends or we quickly become outdated. My love for front end development shows this perhaps the most. You can’t avoid change. Maybe you search out the next hot framework for your new project. Perhaps it’s keeping up with the best way to build your applications. Even our choices of how to preprocess our stylesheets change often. In the past two years, I’ve seen two or three tools of choice rise and fall in each category. That’s insane.Luckily, working on the server-side feels a lot less like chasing trends. Yes, there are some overarching ones that tend to operate on a much larger timescale. In the late ‘90s, PHP became the choice for people who just wanted to build web apps fast. By the mid to late 2000s, Ruby and Python captured mindshare in the same category. And more recently, Node.js made its way into the discussion.What’s next? It’s tough to say. There isn’t a language dominating the field. I’ve chosen three to discuss in this article, but I could just as easily have added a half dozen more. The big trend we are seeing with these languages is that they are designed to handle concurrency. Consequently, many tend to be functional languages.So let’s dig in and discuss what Clojure, Elixir and Go all have going for them.

What are they?

Before we discuss who should look at which languages, let’s first look at what these languages are and what their code looks like.

Clojure

Clojure is a modern Lisp running on the Java Virtual Machine (JVM). Lisps have been around since the ‘50s, yet are once again gaining popularity as they solve many of our toughest problems. Clojure’s advantage is sitting atop the JVM, giving it access to the vast ecosystem of Java libraries. On top of that, teams can migrate existing Java apps over without paying the price of a full rewrite. Further, the JVM infrastructure gives it decades worth of performance optimizations. It has many tools for writing concurrent code, implementing ideas like Agents from Erlang and Communicating Serial Processes (CSP) from Go.Here is the code for Project Euler Problem 1, which is to produce the sum of all numbers under 1,000 that are divisible by either 3 or 5. Reading Clojure can require skills that you haven’t learned in imperative languages. It can be described as reading the code from inside-out, rather than top to bottom. It gets easier with time. Part of the beauty of Clojure is there are few exceptions to the basic rules of the language. Yet by building on those same basic rules, adept developers can extend the language in very powerful ways. It’s perhaps why Paul Graham attributed a Lisp as his secret weapon for building his first startup.Project Euler Problem #1 in Clojure

Elixir

Elixir is a functional language syntactically similar to Ruby that runs on the Erlang VM (BEAM). Being Ruby-like helps its code feel familiar and subjectively beautiful. Running on the Erlang VM makes it easy to write high performing, fault tolerant code. In fact, one of its greatest features is the ability to let code crash without bringing the system to a halt. Its concurrency constructs are direct from Erlang: Actors and Agents.You can see that the Elixir code looks like the Clojure code above, but with a more Ruby-esque take on things. In Elixir, you’ll often use the pipe (|>) operator to structure your code in a more readable way. Although the syntax is similar, the paradigms are very different. Where Ruby is object-oriented, Elixir is functional. Learning how to write code in a functional way is the biggest challenge to those who haven’t worked with functional languages before.There are, however, some edges to the language which don’t make sense at first. I think many of them owe their heritage to Erlang. It’s that occasional twist that makes the learning curve steeper than it need be. However, I find myself loving features like pattern matching, destructuring and guard clauses. With them, it’s easy to write concise, declarative code.Project Euler Problem #1 in Elixir

Go

Go is a compiled, statically-typed language built in the style of C. The language feels small and—unlike many statically-typed languages—it eliminates repetitiveness and verbosity. This makes it feel a lot more like Python or Ruby than Java. Go is also generally the fastest and least resource-intensive of these languages. It popularized CSP for handling concurrency with goroutines and channels.In the code below, the solution to Project Euler Problem #1 looks like almost all other imperative languages. It uses mutable state for loops and if statements to do the work. Go is also very opinionated. Many languages let the developer make style choices, which leads to arguments over things that don’t matter (spaces vs tabs, single vs double quotes, etc.). Go avoids that debate altogether thanks to its tooling. Go’s toolset is amazing. The creators put a lot of thought into removing the pain points developers face.Project Euler Problem #1 in Go

Who is it for?

We touched on the idea that programming languages tend to dominate niches. There is no one size fits all. Java and C# match the demands of enterprise companies. Ruby and Python are great choices for quickly putting together maintainable web apps. Node.js fits great for heavy I/O applications. Who are these languages built for? Where will they succeed?

Clojure

Clojure is attracting developers on the cutting edge: those who like to learn new things and feel smart. It is one of those languages where, whenever I find myself writing complicated code, there is always a more elegant way. It helps that Clojure’s creator, Rich Hickey, is one of the best at what he does. He’s brilliant and his talks have left impacts like few other speakers in industry. Clojure is such a well designed language and a pleasure to program. You have to try it for yourself.Thanks to being on the JVM, it is also attracting the attention of smart enterprise teams. The language has even expanded to the client-side thanks to ClojureScript, a dialect that compiles down to JavaScript. It is one of those rare languages that you can write an entire web app in.Some subset of companies, primarily building web apps, will adopt Clojure and do really well for themselves. They’ll move faster than their competitors and hire fewer but higher quality devs. Lisp feels like a perennial secret weapon, despite the fact that its practitioners keep shouting about how awesome it is.

Elixir

Elixir appeals largely to those with Ruby or Erlang backgrounds. Its creator, José Valim, was a Rails Core developer, so it’s no surprise his creation draws much of its inspiration from Ruby. Because of its esoteric syntax, Erlang has been one of the least approachable programming languages. Yet it sits atop an incredible piece of technology. It’s the same technology which handles most of the phone calls in the world with 99.9999999% uptime. That is 32 milliseconds of downtime a year. The creators of WhatsApp scaled to hundreds of millions of users with only a few developers in part thanks to its robustness. Elixir brings this technology to the broader public.Thanks to the Phoenix framework, Elixir will attract a lot of Rails developers. It feels like the next generation of Rails in a functional flavored Ruby. It does things with ease that Ruby has been hacked into doing: long-running processes, multi-core processing, and WebSockets, among others. I think we’ll see Elixir use grow for both monolithic-style minimum viable products and for apps that require high user concurrency like chat, messaging, and audio/video calls. The platform can also see interesting uses in Internet of Things and machine-to-machine applications because of its ability to handle large numbers of connections.

Go

Go is establishing itself in many domains. The enterprise is loving it for plenty of reasons. First, it’s being built and maintained by a large company: Google. Corporations fear risk. Having a big company spending money on a language diminishes the risk of it eventually going unmaintained. Second, Go is more familiar to already popular languages in the enterprise. Less of a perceived learning curve is also given a lot of weight by big organizations who have to consider the cost of training thousands of employees.Go is also succeeding with the web app crowd. It’s incredible that a language has appealed to both of these large domains. The language is a great fit for RESTful API development, which is the favored way to build apps these days.Many people moving to Go are coming from Ruby. Stories abound of rewrites from Rails cutting server costs by 90%, increasing reliability by 10x, and making response times 10x faster. The migration goes beyond Ruby. TJ Holowaychuk, perhaps JavaScript’s most prolific developer, famously moved to Go two years ago. It is attracting some of the greatest talent in the industry.I expect to see Go get a lot of use for building API’s, infrastructure, and many large internal enterprise products. Of the next generation of languages, Go is the one I think most likely to break into the top 10 most popular programming languages.

Head to Head

I often evaluate and compare tools, so here’s a little insight into my process. After narrowing down the tools based on their technical merits, I begin looking into the more fuzzy aspects which impact the choice.First, I like to look at trends. How popular is it compared to its competitors? Is it growing more popular? Google Trends helps a lot with these type of questions.Here we see the absolute numbers in how popular these terms are in Google. Clojure rose in popularity soon after it was released, but its volume has leveled off. Go saw a huge spike when it was first released, followed by solid and consistent growth. Meanwhile, Elixir is the newest and least known.Finally, I think about community. Support is so important. That means getting answers to questions on Stack Overflow, reading blog posts with ideas, finding quality libraries on Github, or being able to find a job using the language. These languages are still young, but I’ll leave this table for getting an idea of what’s out there:ClojureElixirGoGithub Stars5,1206,44514,994Github Contributors125358597Github Projects36,9889,338111,364Most Popular ProjectsLightTable, ClojureScript, OmPhoenix, Ecto, DynamoDocker, Kubernetes, GogsStackshare Stacks11260502Stackshare Fans14382553Stackoverflow Questions11,1531,47514,146Stackoverflow Followers5,1001,4008,800Original Release Year200720122009Having shared all that, right now I’m really high on Elixir. The others are excellent as well though. I actually think that out of all these languages, most people should choose Go because it’s going to be the most popular, the easiest to find a job, and be able to handle a ton of different types of software. But for me, Elixir is a lot of fun. I get to take advantage of the incredible Erlang VM, and my code feels clean. Tough to beat!

5 Parting Thoughts

Go is the most boring of the three

Boring isn’t always bad. Writing tests is boring. Creating the umpteenth page that’s just like all the others in an app is boring. Crushing my head against a problem for hours is boring. Boring creates a lot of value. If you want to learn one of these languages and easily find a job with it, Go is your choice.

Clojure is the best designed language

It’s hard to beat a Lisp in this category. It’s especially hard because Rich Hickey makes great language design decisions. Best designed doesn’t mean most successful—not by a long shot. But if we all didn’t have a background in imperative, C-style languages, I don’t doubt more people would pick up a Lisp.

Elixir is the most fun to program

Something about the interactive programming experience really vibed with me. The Erlang ecosystem allows programs to crash and recover and to hot swap code out of the box. Clojure can do these things, too, but they need extra setup.

New apps should be written with concurrency in mind

I’m a polyglot who has learned nearly a dozen programming languages. Every year, I take on a new Perlis language (this year’s winner is Elixir!). Also, every year it becomes more and more apparent. We are past the point where you can scale up one processor to make your app faster. Nearly every new language is being built to solve this problem. If you are wanting an app that can handle what the future holds, demand to use one of these languages.

If you are a developer, you need to learn one of these languages

None of them may be the Next Big Language (NBL). Yet, ideas from all are likely to make it into that NBL. These are also the type of languages that having in your Github profile tell me you’re likely the type of developer I like working with: the ones who are practical and pushing things forward.Try them all out. See which one you like best. Right now for me, it's Elixir. Are you playing with any of these? Are there others you're looking at right now?--Need extra muscle on your Next Big Project (NBP)? Get in touch.

Subscribe to the Smashing Boxes Blog today!

Smashing Boxes is a creative technology lab that partners with clients, taking an integrated approach to solving complex business problems. We fuse strategy, design, and engineering with a steady dose of entrepreneurial acumen and just the right amount of disruptive zeal. Simply put, no matter what we do, we strive to do it boldly. Let's talk today!

Related Posts

The Foundation of Digital Transformation

Digital Transformation -- the pivotal process of using emerging or new technologies to modify or improve how your organization or product functions; improving your business processes, corporate culture, and customer experiences to align with evolving market dynamics.

view post

Cracking the Blockchain Code: A Comprehensive Guide

Discover the intriguing world of blockchain technology in this comprehensive guide. Unveil the inner workings of blockchain mining and gain an understanding of how this revolutionary technology is transforming financial transactions.

view post