The Elm Programming Language

in #programming8 years ago

When it comes to front-end web development, having to deal with JavaScript is almost a given. I'll get to Elm in a bit, but first I'm going to come out and say it:
I do not like JavaScript.
You may, and even probably do, disagree with me; you might even be saying, "I use JS on the back-end, too, thanks to Node!" And that's cool. I'm sure you and I have different use-cases and soft requirements.
Here's what I dislike about it:
With its dynamic typing, poor options for test-driven development, a hundred ways to implement the same function, a community that insists on moving to the next hot thing every 6 months, and lack of decent IDEs, JavaScript leaves much to be desired. If you're interested in some of its popular libraries, clunky systems such as NPM (Node Package Manager) do exist, though I find that it suffers from "works on my computer" syndrome.

AngularJS

If you've done much work in JS, then you'll know that AngularJS came along and offered a popular approach to simplifying the work needed to have a proper MVC (model-view-controller). However, Angular is also a slow hog and isn't the most intuitive to deal with. By the time Angular 2 rolled around (which is completely different from Angular 1, and thus incompatible), it was already being overshadowed by React.

React

React offers improved responsiveness, server-side rendering, and a more idiomatic workflow (as long as you keep your project's directory structure sane). As well, you can create reusable components by incorporating HTML directly inside JS (as opposed to JS inside HTML... a huge improvement, in my opinion). However... React's learning curve is a bit steep, and it gets much worse if your team fails to adhere to React's recommended recipe. And unfortunately, we're still programming in JavaScript here.

Elm

While it's true that Elm compiles down to JavaScript, Elm itself is built to be a minimal and highly functional language. Elm is extremely opinionated, and there are only a few ways to write the same code. Using Atom with a few plugins makes for a decent IDE that's able to automatically format your code (the Elm community has determined that there is exactly one way to format code) and issues helpful compiler warnings. Once compiled, the code is nearly guaranteed to be safe at run-time. It's true that there is a ways to go before Elm can address my other concerns with regards to JS (testing, dependency management, etc), but the community is off to a great start.

Let me know what you think! Leave a comment teaching me how to enjoy JS, or if you want to learn more about Elm, visit here: http://elm-lang.org/