TorchShip logs

Using Elm for sideprojects

October 02, 2019

Elm makes side projects fun again

First a little backstory. I was hired as a frontend developer for Omicron Media because I had experience with some functional JavaScript. Our product is built with Elm. I had almost zero experience with Elm prior to getting hired on. So to gain experience as quickly as possible I decided to start a side project I’ve had in mind for some time. That project was Vertol

Elm is perfect for your side projects even if you can’t use it at work yet (I’m so sorry if you can’t).

Its main benefits are that it is easy to read (once you get use to it), the community is fantastic, and the compiler (omg the compiler is so great).

The Elm community is half of what makes it such a great language to work with. The Elm Slack is a really great place to get help or discuss code. Most everyone there is super friendly and helpful.

To get used to putting an Elm application together, one has to look no further than the Elm SPA example by Richard Feldman. Prior to 0.19, I took a ton of inspiration from that codebase for Vertol. It’s really helpful to see how it’s structured, and how certain techniques and idioms are applied to an app. I remember working with React and wondering: Do I use redux or not? If I do use Redux, do I use sagas or thunks or observables? Where does this Component’s state live? Not to mention the speed at which React’s ecosystem (and JavaScript’s as a whole) evolves, it’s hard to keep up.

Elm’s idioms are much more present. You have the Elm Architecture to guide you. Most problems I’ve ran into have had examples in Richard’s Elm SPA and the community. Or there are useful functions that exist in elm-community extra modules for common patterns. Also Elm’s documentation is definitely better (imho) than other languages/frameworks.

Elm’s higher profile members seem much more approachable. Whether through Slack or meeting them in person at Elm Conf. All of which makes the language much more friendly and approachable in my opinion. All of the Elm - conf talks are incredibly valuable.

While you’re coding out features in Elm, the compiler is there every step of the way. I’ve never had the level of confidence in a feature as I do now with Elm. Let’s be real, we’re probably not writing tests for our little side projects. But if it compiles, it generally works as intended. If it doesn’t it tells you what to do to fix it. So if you’re halfway through a feature, and life happens and you put the project down, you can revisit it again in 3 months and pick up right where you left off. If it compiles you know you still have a working app. If it doesn’t compile, you know where to start to get it compiling again. I’ve done this numerous times on Vertol. Within minutes it was compiling again. There’s even been times I’ve coded out a whole feature, WITHOUT looking at it in the browser. Just hitting save and watching it compile (or not). Then when I thought it was ready, I opened Chrome and sure enough, it worked.

It’s been my experience that side projects easily make their way into a limbo/sideproject-wasteland of half baked features. Mainly due to the friction involved in maintaining and refactoring as you learn and grow. Elm’s compiler makes refactoring not only more confident but way more fun! I’ve written and rewritten Vertol at least twice (maybe 4 times if you include the chrome extension). Refactoring and trying things out is much more straight forward and less stressful than previous workflows.

You can get stated with Elm using the elm-cli or play with elm-live. Or if you just want to play around and not install anything check out Ellie.

When the time comes and you decide to make your toy app “production ready”, it doesn’t take much more work. elm make —optimize will give you a an optimized bundle ready to ship. You can carry all your confidence into production.

Side projects are a great way to learn new languages and techniques. I believe everyone should learn Elm. Side projects are the perfect proving ground. Hopefully more people can use it at their day jobs.

Some helpful resources I used to learn Elm along the way: