Live data from Hacker News

Why am I interested in Elixir?

underjord.io

51–60 of 183 posts

Re: Why am I interested in Elixir?

#51

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

Same experience here, it truly is an absolute joy. In the front-end, we are using TypeScript with vue-property-decorator [1], it made me like Vue even more. I wasn't much of a fan of developing frontends before, but I actually have been having fun using TypeScript + Vue + Tailwind CSS. I'd also like to try out Svelte in the future.

I'm also doing an startup -- we've been working on the product for only two weeks and we just released access for our first pilot customer, with an initial feature set we are very happy with. Apart from the productivity, it's been a long time since I loved programming. Keep in mind I was doing embedded C development for a few years, so my web-fu is a bit rusty lately.

The only thing I miss sometimes is types, especially when refactoring. Java with IntelliJ will spoil you, I guess. I was thinking about going with Kotlin because of this, but I was really digging the Phoenix project structure and I love Ecto.

All in all, a great experience.

[1]: https://github.com/kaorun343/vue-property-decorator

Re: Why am I interested in Elixir?

#52

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.

* Hardware, from arduino and raspberry pi to embedded chips (https://nerves-project.org/) * Multimedia streaming (https://www.membraneframework.org/) * Financial services backend (divvy) * IoT (http://farm.bot)

The erlang Vm’s roots go back to telephony switches, so there are many cases beyond web.

Re: Why am I interested in Elixir?

#53

Earlier quoted context omitted.

> 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. To be honest, this can probably be almost 100% attributed to the fact that it is not backed and heavily promoted by a tech giant.

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?

Re: Why am I interested in Elixir?

#54

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?

Phoenix LiveView is the Google Stadia of web app. Browser is just like a console for sending commands over an established connection (stateful) to server. It's pushing computation and state management to servers, and eliminating a lot of steps e.g. encoding huge internal data structure to json, api endpoints design, huge javascript downloading and parsing, re-rending that data with template on client side. If you use a compile-to-js language on frontend, the extra step is to decode json into internal types as well.

LiveView is the haven for apps that are focusing on B2B and internal tools in organizations. Because it doesn't have to support offline usage, and cost effective since you don't have to have a frontend team.

Re: Why am I interested in Elixir?

#55
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?

Of course they are, but thé article seems to be from someone interested by elixir, rather than someone who used it long enough to discover them (although I might have misunderstood the article.)

From own experience, the problematic parts are :

- deployment being a bit messy if you try to follow 12 factors (might be improving in 1.9)

- absence of a decent debugger

- younth of the ecosystem and size of the community (aka hard the find a maintained lib that works for a few common issues.)

- compiler being a bit slow to my taste (YMMV)

- then, of course, the elephant in the room: the absence of the kind of static type checking that facilitate refactoring ord relatively large codebases.

Nothing unbearable or permanent, but some things to keep in mind. Go try it !

Re: Why am I interested in Elixir?

#56

Earlier quoted context omitted.

You need to do it this way, it's more idiomatic: with {:user_created?, {:ok, user}} # something _ -> # some unhandled error end And so on, use an atom on the fly to identify branches and error conditions. But honestly most of the time you worry about happy paths and Let It Crash.

yeah this is kind of horrible once you get to high levels of nesting. in an imperative language you can return early in the error paths and your function will still be understandable. this doesn't work with a single return. you can easily have 6 guard statements in an imperative language and your function will be comprehensible try doing 6 levels of nesting in elixir and it will be a complete mess.

Maybe the “OK” library [1] could be useful for you.

I would also welcome a better built-in idiom for early returns.

[1] https://hexdocs.pm/ok/readme.html

Re: Why am I interested in Elixir?

#57
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…

Yeah you may be on to something here. Looking at GenServer callbacks as some sort of pure independent functions would not make a lot of sense, they're tightly coupled to processes/GenServer anyway.

Re: Why am I interested in Elixir?

#58
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.

Re: Why am I interested in Elixir?

#59
post #6

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.

I'm all in static typing, but writing Elixir has ways less anxiety than any dynamic typed languages I've written.

These are features that help eliminating uncertainties:

1. Function head pattern matching

This also includes anonymous functions used in Enumerable functions like map, reduce. Which is my most favorite way of using pattern matching

2. Guard clause

It's part of function definition so it's visible in very nice ways; not mess with the body.

3. Process supervision strategies

Let it crash! The elegant way of dealing with exceptions and unexpected errors.

It's a fair trade with static typing.

Re: Why am I interested in Elixir?

#60
post #50

Earlier quoted context omitted.

Compiled into bytecode to be interpreted by the Erlang (BEAM) VM.

Are we doing semantics now? Java is also compiled into bytecode, executed by the JVM. Do you consider Java an interpreted language also?

I think most people consider Java to be an interpreted language, it's interpreted by JVM. It's obviously somewhere in between, in the same way that JIT languages are, but it's still not native.
Post reply on HN