Why I think Elm is the Future of Front End Development

Elm is a ML-style functional language with enforced immutability that compiles down to optimized JavaScript. It solves a lot of problems that developers writing JavaScript end up facing in a day-to-day workflow. I believe that it is going to be the future of front end development. I’ll be going over a few aspects of Elm that I think make it so powerful.

“JavaScript Fatigue”

I think that one of the biggest reasons to use Elm is to avoid trying to put together all the different libraries and tools to get a scalable JavaScript project going. There are constantly new libraries being released. I think that’s great and it shows that the ecosystem is vibrant, but I also believe it makes it hard to keep up with and build larger applications. Elm comes with everything you need to get started building a scalable front end.

Architecture

The concepts around the Elm architecture at its core are starting to be more widely used. For those of you familiar with Redux, it is very similar to that. The Redux project has looked at Elm for inspiration. It is a simple architecture and the documentation does the best job of simplifying it:

Compiler

Elm is a statically-typed language with type inference. The compiler is the biggest reason why companies working with Elm gets no run-time exceptions. It acts as a very friendly assistant for you while developing. Rather than going through a use case, let me just show you this:

Elm Error Messages

Performance

Elm has always done well with performance due to its compilation to efficient JavaScript and use of the virtual dom model. Many companies currently using Elm have not had to compromise performance for productivity. It just comes built in.

Package System

The package system is one of the most interesting aspects of the Elm ecosystem. It has one feature that isn’t anywhere else (from my knowledge) — it enforces semantic versioning based on the changes to your package. The system can tell if the package is making a breaking change and not allow for the minor version to be bumped and requires the major version bump to publish. This is powerful. There have been numerous accounts of issues in the JavaScript space of package creators publishing new versions of a package that is a minor or patch that actually end up breaking API contracts. That causes many issues and can lead to a refactor or having to change code that you were not expecting to modify. That can be avoided with how smart the Elm package system is. I think it could even be used as a tool to teach people how semantic versioning works in practice.

document.querySelectorAll('.pkg-summary').length;

Success Stories

A Swedish startup that decided to use Elm from the beginning for their project and they describe the benefits and output of that decision.

Conclusion

Elm is definitely on the right track. I think that if you are trying to figure out what to use for your next project, you should give Elm a try. You can even use it with existing projects due to the interoperability with JavaScript. It has a lot of benefits and lasting positive effects on a team and code base.

SRE @ Lattice — https://rishigoomar.com