from Hacker News

Why am I interested in Elixir?

by muhic on 7/4/19, 7:25 PM with 178 comments

  • by nickjj on 7/4/19, 8:36 PM

    I'm currently building a video course hosting platform with Elixir / Phoenix and all I can really say is this has been the nicest tech stack I've ever used in 20 years of web development.

    IMO it really does feel like you get the best of everything (developer productivity, developer happiness, great language for creating maintainable code, OTP and the BEAM bring a lot to the table, it's memory efficient, tracing code without a ton of experience is very doable, it's fast as balls and Phoenix channels / LiveView is a great abstraction on websockets). I find myself fist pumping all over the place as I make progress towards this app while learning as I go.

    I don't think I've liked a technology this much ever and I'm honestly surprised it's not already more popular than it already is. I've been around for the release of a lot of major frameworks and technologies (Rails / Django, Node, Go, etc.). Nothing has impressed me this much. It truly feels like it's a zero compromise environment to write code in and I hope I can still be using it in 10+ years.

  • by anthony_doan on 7/4/19, 8:18 PM

    My current side project is in Elixir/Phoenix and it's sweet. Currently on 1.8.

    I'm hoping to move to 1.9. The language just fit my ideology better, Jose Valim just stated that the language is mostly complete. All major planned features are completed unless something come up. The language isn't bloated, it's small and sweet, and it doesn't go out of the way to add random unnecessary features to the core.

    I was fullstack since ~2008 and it is becoming pretty hard to be fullstack when frontend moves too dang fast for me. So the pace of Elixir and Phoenix is amazing. I know these two technology are relatively new but compare to its peers it's boring tech; as in it's battle proven and it's not going to radically change that often (at least not for the sake of hype or reinventing the wheel).

    The community over at elixirforum is nice. There seems to be quite a few camps. The ones that stands out to me are the web dev and embedded camps.

  • by enraged_camel on 7/4/19, 8:18 PM

    My startup uses Phoenix, along with a Vue front-end. The combo is an absolute joy to use. The benefit that has had the most business impact for us so far is developer productivity.

    A couple of months ago we met with a prospective client to discuss their use cases and conduct requirements gathering. They really liked what we showed them, but the CFO wanted a dashboard that displayed the data in the app in a specific way. We shook hands, told them we would contact them soon, and parted ways. It was around 9 AM when we stepped outside the client's office and got back in our cars.

    By 5 PM that evening, we had a stunning, fully functional dashboard built and deployed to the demo environment. It utilized a few new database tables that aggregated data, some data processing done by Elixir, passing that data to the Vue front-end and displaying it using Charts.js and a few other UI libraries.

    I sent a quick email to the CFO with the URL. He responded ten minutes later with, "holy cow, why didn't you show this during our meeting if you had it already?!" :)

    We are meeting with them again later this month, hopefully to sign them on as a client.

    (For reference, I've used Rails and ASP.NET with C# before Elixir, along with JQuery back in the day, and then a bit of React. Can't speak about other frameworks and languages.)

  • by neya on 7/4/19, 11:51 PM

    I just finished writing my own in-house static site builder in Elixir. I come from the Ruby land. If you thought Ruby was awesome, then you would LOVE Elixir. I was hesitant at first, thinking "not another language.." but once I gave it a shot, I stopped looking back.

    I'm an individual consultant with a very small team. Without Elixir, many projects that I've finished in weeks would have taken me months. This is a seriously under-rated language that would make you wonder why didn't you give it a shot earlier. It's that good.

    My static site is now way faster than Jekyll or Middleman. I didn't re-write it for speed, speed was just a nice side-effect. I wrote it mostly for the language's flexibility.

    With Ruby, which Middleman and Jekyll both use, you need to think in the traditional OOP way and sooner or later, you will hit the limits of the language itself. Whereas, with Elixir, everything is taken care of by guards. This is really one of the nicest codebases I've ever written in a while. This is in comparison to my earlier codebase which was written in Ruby, and I had to do all sorts of things like install a library to make the language more scalable. That was the ugliest hack I've ever done. [1]

    Imagine, a Wordpress clone, only it runs on your computer and generates static files (this was my goal) but, written in less than a month by one person, working a full time job, with the same fit and finish of Wordpress.

    Elixir is amazing.

    [1] https://github.com/aetherknight/recursive-open-struct

  • by c4po on 7/4/19, 11:37 PM

    We are building a sales automation app using Elixir and Vue.

    Our dev team seem really happy with this tech stack.

    Productivity is awesome - we are four months in and already have similar functionality to a (sort of) competitor that has spent several years on their dev. This is the first dev project I have experienced where we are ahead of our planned milestones. Got to find some more features to quickly add!

    My original concern was getting hold of developers as Elixir lacks the pure numbers of people that other server environments enjoy, but this has not been an issue. If anything we have got more senior devs then we would otherwise be able to get as they are excited to be able to use Elixir. Oskar in Poland and Dan in London, hats off, you are awesome!

    Not sure if I agree with others that the broader environment is underdeveloped - yes there may be less versions of the same thing compared to a large JavaScript framework, but what is there is absolute quality.

    Only (small) gripe is that Elixir is not a fast language. At one stage I thought this was going to be a real issue, but great support from the community and improved understanding on how to do things the Elixir way (let it fail!) seems to have resolved this for us.

  • by thibaut_barrere on 7/4/19, 8:10 PM

    The Elixir ecosystem offers a lot of interesting things. I'd like to underline those:

    - LiveView (which I use in production & have recommended for upcoming projects too) is a complete game changer, not because it allows to remove javascript, but because it removes a boundary (between the client & the server), making development & maintenance much faster since you only have one layer, and also making very rich features easier, because you can remain stateful during the processing (if you have interactive rich UIs with e.g. file upload & processing then live reporting as you process the file, this will remind you of desktop programming, in a good way)

    - While the initial setup of apps can be a bit cumbersome to my taste (like the SwitchTower period of Rails - e.g. you'll need a build server or a Docker image typically), the mental model of programming is quite simple in a lot of cases afterwards. I would say that junior developers can be onboarded quite easily (I'm starting to train some), and maintenance is quite sweet at this point.

    I can warmly encourage you to try Elixir out (a nice way to get started by the way is to code ExUnit tests to try out the language, see https://github.com/thbar/elixir-playground/blob/master/test/... as a boilerplate to get started).

  • by dkulchenko on 7/4/19, 7:57 PM

    All the backend code for my current startup is in Elixir (switched from Ruby, my previous love).

    Elixir/Phoenix/Ecto are an absolute joy.

    It took a bit to get used to immutability and FP but it feels so "cozy", for lack of a better word, to know exactly what my code is doing and to not be bit by obscured mutability and magic anymore.

  • by kuzee on 7/4/19, 9:28 PM

    Coming from Ruby and Python and a bit of node, Elixir encourages a really convenient mental model for thinking about small and large parts of your app in the same way. Net result is fewer bugs created, easier to write tests so you write more, and easy to debug when they do happen. And because of the fault tolerance, most production bugs are so transient they're not causing problems. I've run several small webapps with a few thousand users and the maintenance is minimal because of how solid the language is.
  • by SLIB53 on 7/4/19, 8:51 PM

    Elixir is great. It's the most fun I've had programming. I wrote Erlang for a little more than a year, and I grew to like the idea, but found it hard to work with. Elixir is bringing me back around.
  • by wmock on 7/4/19, 11:19 PM

    My experience with Elixir has been great but one area of improvement is debugging. Maybe it's because I'm so used to using something like Chrome's developer tools, but I wish there was something as easy to use for setting breakpoints and inspecting the environment. Would love to know how others are debugging currently!
  • by spraak on 7/4/19, 8:16 PM

    Has anyone who previously preferred static typing converted (at least for certain projects) to using Elixir? I won't even put plain Node into production anymore, TypeScript at the minimum, but otherwise OCaml or Go.
  • by kureikain on 7/5/19, 6:43 AM

    Elixir is a language that I can very productive in day one. Only Ruby+Go enable me to be productive like that. Lot of people get turn down by so many thing in Elixir like OTP and other cool stuff that you never used and think it's complex.

    I literally learn it on the job.

    Lack of typing is the biggest issue for me, but pattern matching enable to get the shape of object and to a certain extent and I'm quite sasitify with it.

  • by colinramsay on 7/4/19, 10:51 PM

    Where are people getting their documentation for Phoenix? The stuff on the website is awful for grasping the bigger picture and how the parts of Phoenix combine. It gave me the impression of being an immature version of Rails when I tried it recently which doesn’t gel with the attitude people seem to have of it.
  • by prodiguy89 on 7/5/19, 5:03 AM

    I'm currently working on my side project the backend for which I've chosen elixir to go with. Looking at performance and long term maintainability, it doesn't seem to be a sucker like rails.

    No magic, no hacky patterns. No mess like the one you see with Node. For what it does the platform is hella stable. I drifted towards Go for a little bit but man, code in Go felt too verbose with weird patterns. Go is a solid platform as well. But it's not just my cup of tea for web apps right now.

    Scalability is in reach if you need it. Hell, even if you need ridiculous background job processing power, use OTP already. And I forgot, liveView is also rock solid. Honestly, if anyone would ask me what the best platform for web apps right now is, I'd just say Phoenix/Elixir.

  • by philsnow on 7/4/19, 9:56 PM

    The most interesting part of Nerves for me isn't rpi/embedded/resource-limited environments, but rather the ability to remove most/all of the security surface area of the userspace (say, in the cloud).
  • by anm89 on 7/5/19, 12:39 AM

    I will definitely be aiming to make my next career move to somewhere where I can be using as much elixir as possible.
  • by SteveMorin on 7/4/19, 8:45 PM

    Great language and importing other technologies though NiF to integrate c and rust (wrapping c or not) with Elixir. My old company build many systems on it and hope another will in the future.
  • by xutopia on 7/4/19, 7:49 PM

    Elixir has a lot going for it nowadays! My side projects are all using Elixir in some way nowadays.
  • by SMFloris on 7/5/19, 4:35 AM

    Elixir is an absolute joy to use. I love to use it whenever I can and coming from Erlang, boy its a step up!

    It's just the Phoenix framework for which the initial setup of the project generator feels so opinionated. You have no options, no way to make a template for the generator. Phoenix's LiveView is a great feature and I want to use it. It's just Phoenix itself that feels off for me, not as straightforward as it should be. Does anyone else get this feeling?

  • by benmmurphy on 7/4/19, 8:27 PM

    coming from erlang elixir is much nicer than that. exunit is miles ahead of eunit and i feel like that would be enough to convince me to switch.

    the with syntax is nice and helps to deal with early exit on errors but still feels a bit awkward compared to imperative control flow.

    like you can do something like this in an imperative language:

        foo, err = func()
        if err != nil {
          return nil, Err("bad")
        }
        bah, err = func2(foo)
        if err != nil {
          return nil, Err("blah")
        }
        return bah
    
    whereas in elixir you have to do something like the following in order to avoid the nesting of doom:

        with {ok, foo} <- func() |> Error.or({:error, "bad"}),
             {ok, bah} <- func2(foo) |> Error.or({:error, "blah"}), do
          bah
        end
    
    like the with blocks kind of work until you have to transform the errors you receive then you need helper functions. if you are just doing static transforms like above it is not too bad but it starts to get hairy if you want to transform based on the returned error or variables in the function. whereas the imperative style you can inline your error handling logic nicely into the function.

    for example what if i want to log something on the error path that includes some contextual information and custom formatting. probably, the easiest way is going to be to use with() and pipe to a custom function that triggers on the error path to do the logging because the code is going to start getting really messy. whereas if i was writing it imperatively i could just inline the logging statement most of the time because it is just a few lines of code.

        foo, err = func()
        if err != nil {
          return nil, Err("bad")
        }
        bah, err = func2(foo)
        if err != nil {
          Logger.error("err: " + err + " when processing: " + foo.name)
          return nil, Err("blah")
        }
        return bah
    
    like i feel this is a bit messy but maybe it is actually not that bad:

        with {ok, foo} <- func() |> Error.or({:error, "bad"}),
             {ok, bah} <- func2(foo) |> Error.or_else(fn err ->
               Logger.error("err: " <> err <> " when processing: " <> foo.name)
               {:error, "blah"} 
             end), do
          bah
        end
  • by allanmacgregor on 7/5/19, 7:40 PM

    Great write up, Elixir definitively deserves all the attention is getting and likely more. I recently helped my team so solve a huge blocker on a project, we had to create a few proxies to handle large amounts of data.

    With very little effort or development time we where able to put together a highly scalable solution that is robust and very low maintenance.

  • by aloukissas on 7/4/19, 9:35 PM

    Spot on! I recently wrote a blog how we've been super happy with elixir/phoenix at AgentRisk: https://blog.agentrisk.com/how-having-a-non-typical-tech-sta...
  • by etxm on 7/4/19, 8:09 PM

    Big fan of elixir, FP was something to get used to, but feels so much easier to reason about now that I’m used to it.
  • by Fishysoup on 7/4/19, 9:48 PM

    What are its promising uses outside of web development? From the little I've seen it looks like a beautiful functional programming language, but I'm not even tangentially involved in web development.
  • by ggregoire on 7/5/19, 1:19 AM

    People preferring static typing, what's your opinion about Elixir? Do big projects become difficult to reason about and maintain like with Python and friends?
  • by trevor-e on 7/5/19, 2:37 AM

    Is it possible for someone to create a statically typed language that works on OTP/BEAM, or for an existing language to interface with them somehow?

    I tried learning Elixir a while back and just couldn't get myself to like the syntax/ergonomics. It seems like most of the benefits people list for Elixir are actually attributed to BEAM, not the language itself.

  • by _pmf_ on 7/5/19, 5:53 AM

    I really, really wish Elixir/OTP/BEAM would take hold in the soft real time / large embedded space. Such a nice fit.
  • by navyad on 7/5/19, 9:01 AM

    I am learning Elixir and build small library with it. Looking to integrate the Phoenix sometime near. I have asked feedback for this project on elixirfourm or on its slack channel. And people have been nice and helpful.

    https://github.com/navyad/moviematch