Live data from Hacker News

Why am I interested in Elixir?

underjord.io

71–80 of 183 posts

Re: Why am I interested in Elixir?

#71
post #53

Earlier quoted context omitted.

I love Elixir, but the learning curve was steep. Async everything, dialyzer, macros, Erlang errors, charlist vs string vs iolist... It was a lot to take in. Edit: 4 upvotes in 4 minutes. I guess people are reading this... for anyone who hasn't already discovered it, the saving grace for me was the Elixir Slack channel. I also learned while working with someone who really knows Erlang, which helped quite a bit, too. I…

> Async everything What do you mean by that? Most code in Erlang/Elixir is synchronous, meaning it will block the process (but not the scheduler). Maybe you meant concurrent (or message-passing) everything?

Yeah I'm curious too.

I've written about 2,000 lines of code on this course platform so far and everything except for 1 function is synchronous from a "this is my code" standpoint. I only used Task.start once to launch something in the background.

Re: Why am I interested in Elixir?

#72
post #12

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…

Are there no bad parts?

There might be (and probably are), but I haven't really come across anything yet that made me think I chose the wrong tech or I'm deeply upset about a certain design decision.

On the other hand, there's so many nice things that you can take advantage of without being a functional programming / Elixir god and every time you figure something out you think "how the heck was I able to survive before being able to do this?". I'm hardly an Elixir veteran but I'm past the Kool-aid phase. I still get amazed almost every day working on this project for 2-3 hours a day.

Re: Why am I interested in Elixir?

#73
post #12

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…

Are there no bad parts?

- deployment is terrible like really bad

- average performance ( like 10x slower than Java even worse for CPU intensive tasks )

- dynamic language ( this is the worst part ), working on large code base means problems ahead

- lot of features from BEAM / OTP that are not that useful and done better on modern cloud platforms ( Kubernetes for instance does a lot of similar things but better and more flexible, apply to any languages ) People like to talk about hot code update which imo is a terrible idea, you should have a proper CI/CD pipeline to do that and not rely on dangerous features like that.

- lack of ecosystem / libraries

- it's FP, I count that as a personal cons

Re: Why am I interested in Elixir?

#74
post #21

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(f…

The idiomatic way to do that is to match errors in the else branch of the with statement. I've been using Elixir and Phoenix for a customer for a couple of years. It's ok to great, especially when spawning jobs, with some stains. I'm not a great fan of the with syntax. I wish they implemented it as a native statement of the language instead of as a macro. In that way they probably could let us write the same code ins…

I think one of the big points about being a true OO language is that the only way to talk to a process is via message passing. To me, the handle concept makes sense when you consider that it's handling a message in its mailbox.

Re: Why am I interested in Elixir?

#75
post #45

Earlier quoted context omitted.

I love Elixir, but the learning curve was steep. Async everything, dialyzer, macros, Erlang errors, charlist vs string vs iolist... It was a lot to take in. Edit: 4 upvotes in 4 minutes. I guess people are reading this... for anyone who hasn't already discovered it, the saving grace for me was the Elixir Slack channel. I also learned while working with someone who really knows Erlang, which helped quite a bit, too. I…

Hmm, I'm primarily a C# dev and recently spent a morning getting to know Elixir, and was actually surprised with how flat the learning curve was. Now, writing idiomatic functional code while coming from an OO background, now that is difficult! I have to say though, I loved the short time I spent with Elixir so far - it's hard to put a finger on it, but it just feels right. But... I do wish it was statically typed :(

> Now, writing idiomatic functional code while coming from an OO background, now that is difficult!

This is one of my favorite parts. I mostly program in Python and Ruby and am very very wired to write programs in an imperative way.

So when you finally "get" things like Enum.reduce and you use it twice in 1 day to solve 2 different problems, it's a real rush.

Re: Why am I interested in Elixir?

#76
post #47

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.

From your comment I gather you're new to FP. Same here, but with around 20 years of OO experience, I really struggle to understand what idiomatic FP code should look like - was wondering how you'd coped on that front?

I don't have a direct answer to your question, but once I've played with Elixir a bit a couple years ago on simple projects, the whole FP paradigm clicked, and now I'm writing Elixir full time and immutability/functional programming has become second nature. Everything's just a matter of transforming data from one shape to another.

Re: Why am I interested in Elixir?

#77

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.

The actual API reference is top notch: https://hexdocs.pm/phoenix/Phoenix.html

But I'd suggest reading through "Phoenix In Action" to get a feel for how everything composes together, but its surface area is much smaller than Rails (though I haven't used Rails in a decade)

Phoenix only deals with the web framework component. If you want to talk with databases, the official library is Ecto. For GraphQL there's Absinthe.

Re: Why am I interested in Elixir?

#78

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(f…

You also have to consider that the whole BEAM philosophy is "let it crash".

On a "normal" language you have to deal with all error paths or your app goes down. On the BEAM you handle the happy case and common and unexceptional errors. Otherwise, let it crash.

Example: if your app depends on a database that once in a blue moon is unreachable, don't test for connection errors. Just assume the connection was successful, and if it wasn't, most of the time once the process restarts everything is fine.

I have an Elixir app in production, I get Sentry errors once in a while about some weird state outside my control (we work with external APIs) that caused a process to crash, I just ignore them and go on with my life.

EDIT: I highly recommend this video from Saša Jurić: https://www.youtube.com/watch?v=JvBT4XBdoUE

Re: Why am I interested in Elixir?

#79

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 feature…

I can't tell what your description of LiveView is suggesting, I will need to read about it, sounds interesting. Is it like a codebase that is implicitly split on a back-end and a browser, without the need to write JavaScript?

pretty much like .NET Blazor and SignalR
Post reply on HN