Interview with EMPEX LA Speaker Will Ockelmann-Wagner
This interview is part of a series of interviews with EMPEX speakers. Today we hear from Will Ockelmann-Wagner, software developer at Carbon Five, who is giving a talk entitled “A Swarm of Processes — Simulating Ant Foraging Behavior with OTP” at EMPEX LA on Saturday, February 10, 2018.
How did you get into Elixir?
I was working at a FinTech startup. We were doing a Ruby/Sinatra backend, and the CTO brought it up as a cool thing he had learned about recently. This was about two years ago. Meanwhile the other developers started playing with it and were pretty impressed with the mechanics, pattern matching, immutability, and the general feeling of the language.
We had to do a new backend admin system that was going to have 4 users, so we certainly didn’t need the concurrency, but we were all into it and decided to go for it and convince the CTO. It ended up going well. With Elixir, we talk a lot about the performance and concurrency and uptime, but just as a language, we were a lot happier than when we were writing Ruby.
Had you done a lot of functional programming before that?
reduces instead of
for loops, that sort of thing.
What’s your experience with the Elixir community so far?
Really good. At Carbon Five, where I work now, they host a lot of the Elixir LA meetups. I went to one of those meetups year and half ago and was like “oh, these people are kinda cool and are talking about interesting things and are quite welcoming,” and that’s how I ended up here. I’ve always been impressed with the Elixir Slack channel. When I was first learning I was on there asking dumb questions and people were sitting at work with Slack open to answer them. It was pretty useful, and pretty nice.
Have you been to other Elixir conferences?
Yeah, I went to ElixirConf in Bellevue last year . That was a lot of fun. It was cool hanging out with a ton of people that knew about this semi-obscure programming language that I was into. You could walk up to anybody and say “let’s talk about GenServers or process registries or whatever.” Some of the talks were pretty fun, about tracking airplanes and all kinds of crazy stuff.
How would you rate the vibe to other communities you’ve been part of?
I think that Elixir right now has more people that are excited about it than are actually working in it. It seemed like a common thing that people were asking each other at the conference was “so, are you actually working in Elixir? Does anyone actually pay you for this?” and people who said yes I was very impressed with. So I think that’s cool.
What are some of the challenges the ecosystem faces in the next year or two?
Adoption is a big one. We’ve found at Carbon Five that it’s challenging to convince clients to make the leap to Elixir. They’re worried about being able to recruit people, that nobody knows the language, and what if it goes away. Of course, on recruitment I think there’s an argument that it’s good for recruitment, because even though it’s harder to find experienced Elixir developers, if someone’s an experienced Rails developer, they could get a Rails job anywhere. But it’s hard to find an Elixir job.
I think getting to the point where non-technical folks have heard about it and feel the way they do about Node, like “my nephew uses Node, I hear that’s good.” If we can get to that point that’s a big step towards having it as a good default, not just when you need the concurrency, but just in general. This is a nice way to write anything.
What are you excited about in Elixir 1.6?
Everyone’s hip to the formatter. Do you have a second-favorite feature?
That it works with ElixirLS, which only works on VS Code and Atom. If you’re using one of those editors, it does the
mix format integration and incremental Dialyzer checks so you’re getting little squigglies under type errors that Dialyzer is finding in your code. I’ve been doing a lot of Typescript on the frontend and I got used to having the compiler find bugs for me. Getting that — or at least, most of that — in Elixir is pretty cool.
How did you pick the subject for your talk?
The talk is about ants and I was reading a book, Soonish, that’s about upcoming technology by the guy who writes SMBC. They were talking about swarming robots so I got interested in that and came across something talking about an ant colony optimization algorithm that uses how ants work to do recruitment and pathfinding to solve traveling salesman problems. I was reading about how these independent actors that have a few simple rules and a little bit of state can coordinate to do interesting things. So this light bulb in my head was like “that sounds like Elixir, and that sounds like a GenServer.” I was looking for a fun GenServer project and it seemed like it worked, and I figured people might want to see it and get inspired.
I think the actor model is a good representation for mental processes.
I’ve thought about how functional programming is a good way to model how your brain works: a decision you made is a function of past information that you have and information about the state of the world and then your own personal little algorithms in your head that output whatever decision that you’re going to do.
Who would be most interested in your talk?
If you’re at a point where you’re into Elixir, maybe writing web apps with it or you’re using it in a way that you would have used Rails or Django or Node or something, and you’ve got Phoenix figured out — that’s the first step. That’s how you get into Elixir. Then you learn about all this OTP stuff, like “okay, that’s cool, but I don’t have that in my day to day.” It’s more of a paradigm shift when you’re used to Sidekiq, like “how do I use these actors.” So somebody trying to get their head around what exactly you do with OTP.
Obviously you’re not going to be writing ant simulators because I’ve got that on lockdown [laughs]. But seeing a good example of something that would have been hard to do without it will be inspiration to see how you can use some of this tech.
This one was fun because I came at it from an OTP standpoint. If I had done this in another language I would have thought about the database first. I would have chucked all the stuff in the database and written a bunch of controllers first and then written a bunch of models and that would have been that. Instead, I started with GenServers and it ended up being a more beautiful domain model and came out a lot nicer than if I had done it in Rails.
Are you using a database at all?
No. Just actors and GenServers.
That’s cool. There’s ongoing discussion about storing state in Elixir and people who think you don’t need a database.
This is one where if you’re running on a free Heroku instance and the server goes down, all the ants die. It’s pretty transient.
It’s tough being an ant.
Do you have advice for people coming to Elixir?
Watch Chris McCord’s Phoenix 1.3 talk where he talks about bounded contexts. I hadn’t gotten into domain-driven design and it’s been really mind-expanding. Instead of thinking about controllers and models first, think about your domain and think about the way that your data ought to be persisted and transformed. Then only later, at the very end, tack on the web stuff. Now that I’ve learned that, when I go back to old code, I’m unimpressed by it [laughs]. It’s a technique I’ve been able to bring into Angular projects and Rails projects.