Chapter 3
Elm

by Bruce Tate

Every day, we programmers make easy things hard. Many of us have coded business applications in C++ and Java, barely pausing to believe that there might be a better language for the job. I’m reminded of the sheep dogs in Babe—my daughter’s favorite movie—that frightened sheep into their pens with amazing acrobatics until Babe came along and just talked them in.

JavaScript has been an enigma in the browser. In some ways, it has given us more than we expected. The embattled language provides behavior far beyond HTML markup, and it is just about universally deployable. But in the end, JavaScript is still just JavaScript. There’s no module system; it suffers from weak typing; it is conflicted and inconsistent. You probably know the other arguments by heart. In the short term, we’re stuck with it. The result is a front end that reflects all of the limitations of the language. You have to work harder with more complex applications, but without the added support that a better type system might provide, it’s just like lambs to the slaughter.

On the browser side of things, we’re starting to break through. You don’t have to be stuck with muscling the sheep into their pens the hard way. Reactive programming, a relatively new model that focuses more on the flow of data than events, is simplifying the way we approach problems. Several languages with better consistency and better type systems now compile to JavaScript, so you can think of it as more of an assembly language on the browser with many available programming options.

In the Haskell-inspired Elm, we’re seeing the potential of a language, and programming paradigm, built from the ground up that compiles into JavaScript and is fully reactive, with an excellent type system. You get better typing and a much more powerful programming model, leading to much better experiences for both the programmer and the end user. Rather than doing all of those callbacks and keeping those types straight in your head, you can just let the language do the talking.

That’ll do, Elm. That’ll do.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset