As you may have noticed, I’m an informed fan of Elm. I’ve been to the Elm Netherlands meet ups and it was only logical for me to travel to Paris for the Elm conference. A little sidenote: I gave a recap talk during the last edition of the meetup, my first meetup talk ever! Look out for the links to the recording on the Meetup page.
Thalys brought us to Paris and a 5-star rated Uber driver brought us to Villejuif, a 20 minute walk from Efrei, where the conference was taking place. First day we checked in and received some shirts and a very fancy wristband which served as nothing more than an entrypass.
Growing Elm code with Evan Czaplicki
For those who don’t know Evan, he’s the benevolent dictator of Elm and creator of the language for his thesis in 2012. There were two keynote talks at the conference and this was the first. Elm as a language is still gaining in popularity and is quite different compared to the more well known frameworks / languages for frontend. The effect of this is that there is yet to form a consensus or best practice for writing and growing your Elm code or applications within the community.
Would you rather change 20 files within a Elm codebase or a JS one?
One of two important lessons is that the number of lines in a file is no longer a measure by which you can say: ‘Here be dragons’. Reason for this: the Elm language and compiler provide developers with a lot of guarantees.
The other lesson: when you’re building your application and thinking of abstracting something away to a module, don’t. First build for your current use case and build it naively. Only when you have another use case that is clear revisit your code and try to decide what is similar or the same. The parts of your code that are the same can be abstracted, things that are similar should just stay separate.
Scaling Elm apps with Richard Feldman
What Evan did in his talk the first day, Richard zoomed in on. He gave more concrete tips on how to scale and grow Elm code. If you want to see a fully built out Single Page Application, here’s an example by Richard.
What I took home from Feldman's talk is that when building in Elm you can afford to keep on building and duplicating code. After a while you'll discover what can be improved or simplified. After that, do the refactoring. Rinse and repeat!
When you scale up an app, things happen. Specific code gets harder to find, and that’s because you need to keep more things in your head. Even developers are human and have limits to the number of things they can keep in mind. So the advices he gave were mostly about reducing that amount.
- Make sure you narrow your types, this way you decouple functions and make them more reusable.
- Make it easier to filter out code to consider by being selective in what functions return. If it doesn’t return A, it doesn’t have an effect on A.
- Steer away from a object oriented style of programming. Elm is a functional programming language and as such, Elm apps scale more nicely when built like that.
One of the things that stood out to me was the simplicity of the tweaks he made to the code and how he did it 2-3 times over. I suppose this means I should write more Elm code ;)
Would visit again
The conference was a lot of fun, I had a great time meeting a big group of Elm enthusiasts! It was nice to see that NoRedInk (a big player in the Elm community) was there in big numbers. All in all, it was a great way to network with mostly like-minded people and to see that there’s no single typical Elm developer. 2018 has a confirmed second edition and I’ll be going there again!
[Matthijs works as a developer for Infi]