EMPEX Speaker: Juan Soto

Andy McCown
empex
Published in
7 min readMay 10, 2017

Juan Soto, an engineer at Capsule, speaks at EMPEX on May 20th. The title of his presentation is “Functional Data Structures.” Juan sat with me for a bit to talk about how he came to Elixir and his thoughts about the language and community.

How did you get into Elixir?

Juan: So, in college I studied mostly curly-brace languages like C and C++. The first language I used for my own work and fun was JavaScript, doing front ends and Node. After I graduated college I wanted more time to learn things beyond what I studied in school, so I applied and was accepted into the Recurse Center. It’s basically 3 months to do basically whatever you want programming-related. I decided to study functional programming and distributed system, because I didn’t really do that in school.

When I was researching which language to focus on, I first found Erlang and did a little bit of that. But then I found Elixir, and I really liked that it felt like everything that was going into the language was based on many years of experience with other languages. The contents of the standard library, Mix being so helpful, and the syntax/semantics of the language being what you expect them to be. Everything you want is in the language, and if not, there’s a good reason why.

I spent 3 months pretty much only doing Elixir, some Erlang, then I branched off a little at the end doing Haskell.

How was your experience w/ Haskell…?

Juan: I wanted to learn a typed language, so I followed a book called “Haskell from First Principles” by Chris Allen — I think it came out last year. I liked Haskell a lot since it gave me more experience with functional and typed concepts, but the ergonomics of Elixir beat almost everything else at this point. Almost any task is more fun for me to do in Elixir. I do think it was a good use of my time to learn Haskell, particularly if you want to get serious about functional programming.

What are your favorite aspects of working with Elixir?

Juan: This is because I come from JavaScript, but I think what I like the most is the standard library. Without any dependencies you can create GenServers or full OTP distributed applications, and that’s just the Elixir part. Erlang exposes a lot of more interesting standard modules — the queue, sets, FSM, etc.

It really lets you focus on the problems you want, instead of “hey, which third-party library do I choose, or which tool do I use?”, it’s all just there. I really like that because it’s always frustrating to me to in JavaScript, or any other language really, where you spend any significant amount of time choosing libraries or focusing on things that aren’t the problem you want to solve.

As mentioned earlier, Elixir is built on many years of experience. You can tell José and the team have had a lot of pain points with Ruby or JavaScript and their ecosystems, and they decided that with Elixir they don’t want to have those problems. I like that attitude.

I take you’re not using it at work right now — it’s more a side hobby for you? So there’s no particular problem you’re applying it to solve right now?

Juan: At work, it’s one of those things where they tell me if we have a service that’s independent, they will let me build it with Elixir, but it hasn’t come up yet. We’re a pretty fresh start-up so we’re still building things from scratch. We don’t really have the bandwidth for me to experiment with languages.

For fun, I apply Elixir to a lot of different domains. For example, Phoenix web apps, like everyone else has done, but I’ve been trying to apply Elixir for more than just the web, getting more into how do I use Elixir as a functional language.

Also like everyone else I’ve tried to make some distributed concurrent apps, mostly to teach myself distributed computing or concurrency, so I’ve been messing around converting some Node code that I had to Elixir, and some old Python code I had that was all synchronous to Elixir

I just like to learn by building stuff — I think it’s a really good way to learn a new language or concept.

How did you pick the subject for your talk?

Juan: Something I noticed about the Elixir community is that everybody’s pretty practical. Almost every discussion about Elixir has to do with building a production system, or relating to Phoenix, how do I make a web app, how do I use Ecto, and that means that people are using this in real life. That’s great, but I think a lot of people forget that Elixir is a functional language, and with that comes more than just how to use map, filter, and immutable data structures. They’re a very big part of Elixir, and I love them, but I think people stop there.

What I want to show people is that just with pure functions and lists you can represent data without actually having any place to store it. You can represent lists with just pure functions, you can do queues with just lists, and you can do lists with queues.

I think a lot of people forget that the combination of that and pattern matching makes a lot of more complex problems very easy. I want to get people thinking about “with this functional language, how can I represent this data structure that is very annoying to write in Java?”. The reason why I want to get that in peoples head is not because I want people to be writing red/black trees or heaps, but because I want them to apply that kind of thinking to their problems.

I guess it’s because I studied Haskell a bit, I feel like in the Haskell community a lot of problems are approached by “how can I apply a functional pattern I know to this problem?” — recursion, pattern matching, etc. In a lot of other languages it’s like people reach out for a 3rd party library pretty quickly, or they think that if it’s not readily available it’s too hard. I think Elixir gives people a chance to be in a friendly language that is easy to get started with and also experiment with functional programming on a higher level.

What would you like to see in the community?

Juan: I think the community has enough resources for beginners, even if you ignore the official books. We’ve reached a point where we need books to come out on hard subjects, using Elixir. I would really love to see a distributed systems book in Elixir or Erlang.

I’d also like to see resources on how to build complex systems with Elixir. For example, in one conference someone gave a talk about a food company, it was called “Selling Food With Elixir”, and they talked about four OTP apps; from Phoenix, to communicating with point-of-sale servers, cash registers, and I thought that was really cool. He went beyond “how do I make a todo app with Elixir”.

I think the community needs that at this point way more than more beginner material. We’ve already convinced a lot of beginners to try Elixir, but I think we need to convince experienced programmers and get the beginners to the next level. A lot of beginners stop at making web servers and don’t really learn everything they could be learning. If there’s more literature on Elixir at a higher, more complex level, I think we’d get more experienced people doing Elixir.

Last year’s Designing for Scalability was really good advanced resource, so that’s a great example. I’d like to see books that are not about Elixir but use Elixir for teaching difficult distributed or functional subjects. I also wish I could write one, maybe in the future!

Maybe that’s next year! Any advice for developers moving to Elixir?

Juan: Sure. If you’re moving from an imperative language I recommend to take it slow. Don’t jump into “let’s make a full app with authentication and databases with Phoenix” just yet. Take a couple of weeks to learn the basic syntax from the official guide, understand what pure functions mean, what immutability means, and try to rewrite little programs in Elixir. Make sure you understand every new concept.

In the Elixir forums I see a lot of people people rushing their learning. They rush through pattern matching, they rush through Plug, they rush through Ecto. and most importantly rush though OTP. Eventually they start having a lot of problems and feel frustrated. Elixir is not like Ruby or JavaScript, and Phoenix (especially 1.3) is not like Rails or Express. A lot of things are built from the ground up kinda differently, especially Ecto. Take your time to understand them.

I think people need to stop trying to learn Elixir in a week, and take 3 or 6 months. A lot of developers now, in all languages, rush through learning. I don’t think that works long-term. Nothing bad will happen if you can’t write a production Phoenix app in your first month. Understand why is a feature you like or don’t like is designed that way, where the ideas come from, and how do you build things with those ideas.

Thanks to Juan Soto for taking the time to talk with me, and don’t forget to get your tickets to the Empire City Elixir Conference being held on May 20th, 2017 in Manhattan. See you there.

--

--