1. 1

    great article! so many times I caught myself saying ‘yes!’. thanks so much for writing this.

    1. 1

      ha, thanks a lot for the nice words. Glad you enjoyed it! :)

    1. 34

      I’m of the firm opinion that Elixir is the going to be, for me, the main language for backend production systems for the next decade of my career–having tried PHP, Ruby, JS/Node, Java, Python, C/C++…it just feels right. But.

      Buuuuut.

      The thing that makes Elixir good beyond the points mentioned in this article is a pervasive conservatism and desire for quality, mostly because of its adjacency to Erlang/OTP and that community of responsible engineers solving unsexy problems. Elixir has adapted the (often clunky) tooling of Erlang and has done a lot to bring it up to standards developers expect in modern projects, but without going whole-hog new-shiny as we’ve seen with, say, ActiveRecord or Rails or Meteor or whatever else.

      Except, that doesn’t last. As more and more developers (looking at you, Rails folks) come streaming in to get into the Next Big Thing, expect that conservatism to give way to poorly-written libraries, to new frameworks to give conference talks, and to code written in complete ignorance of the performance characteristics in the underlying system.

      I’m currently neck-deep in a legacy Phoenix system (yes, such things do exist!), and I’ve seen (in our and others’ projects):

      • Well-meaning developers using Verk (a port of Sidekiq/Resque, basically) for work queuing instead of just normal supervision trees
      • Excessive use of tooling for hot code swapping/reloading just because Elixir/Erlang/OTP supports it, regardless of the cost when things don’t work correctly. Simpler deployment makes sense
      • Pipeline operators used in place of bog-simple nested parens for arithmetic
      • Pervasive use of maps where structs would be better typed and more reliable
      • Pervasive use of string values where atoms would be more efficient
      • Use of blind exception throwing instead of god-fearing Erlang {:ok, ... }, {:error, ... } tuples that can be handled correctly
      • Overly-clever metaprogramming (I’m looking at you, Phoenix router)
      • Ignorance of core Erlang documentation and features (docs, for some reason, not reliably included by the Elixir folks…probably to discourage their use)

      And outside of that, I’ve seen a (subjectively) massive increase in the number of me-too and one-off projects on Hex that show that people are sharing buggy, poorly-tested libraries and others are piling on because Elixir is TEH NEW AWESOME.

      I fully expect somebody (maybe @355e3b) to write something like “The Gentrification of Erlang/OTP” to explore this troubling trend further.

      1. 12

        Haskell’s policy of “avoiding success at all costs” is looking more sane by the year.

        (I’m probably misusing that quote.)

        1. 3

          misbracketing it at any rate (:

        2. 5

          The way to fix this is not to complain and grumble but to do the blogging, talking, and teaching to make things better. To that end I’d much rather see @355e3b teach us what he knows and help us all get better at Erlang/OTP and maybe even Elixir as a byproduct.

          1. 6

            This is the problem with technologies that get HN/blog hype. Add to this mediocre learning materials written by people with no production experience to make a quick buck (“buy my book/course on Elixir for $5!!!”).

            The issue is simple: People rushing to get experience with Elixir and not learning it or OTP properly. It’s all about being able to put it on your resume or GitHub instead of actually learning it.

            I fully expect in five years to see people say that you don’t need OTP to be an Elixir programmer.

            1. 1

              Hey - thanks for your excellent remarks!

              Personally I’ve also seen the OTP use go the other way - “There is this great OTP stuff so we gotta use it!”, where a simple function would suffice people try to use supervisors etc. for no reason other than to just do it. Or “I have to use OTP so I create a single GenServer which I’ll delegate all requests to”, which is basically you taking a parallel system (all requests in phoenix are their own process) and creating an artificial bottle neck by sending it all to a single process.

              A serious question about your Verk remark (note I haven’t used so I don’t know what it does, more general about background job system): I see that I’m less likely to need a background job system in BEAM land. However, when I have it in the BEAM (Supervisors, Genservers maybe ETS etc.) and don’t do hot code upgrades the jobs get lost when I restart/stop&start the application, don’t they? Am I missing something? Same thing with maximum retries and exponential back off - should everyone re implement those themselves (like we do a lot of API calls to notoriously unreliable APIs of partners)? When I really need those, I’d happily use a library to achieve them. Am I missing something essential here?

              1. 2

                My initial reaction for that would be to look at dets and even an Elixir-wrapped Mnesia. For the retries and exponential backoff, again there are Erlang libraries that have solved them for quite a while, and yet people are still kinda introducing new ones. It’d be nice if we got more of that standardized into the standard lib. :)

                And yeah, excessive use of OTP is also a problem–people get really enamored with tools and may misapply them.