Live data from Hacker News

Ask HN: Are you satisfied with Elixir or do you regret choosing Elixir?

news.ycombinator.com

191–200 of 297 posts

Re: Ask HN: Are you satisfied with Elixir or do you regret choosing Elixir?

#191
I picked Elixir to develop Statuspal 4 years ago as a solo founder, I’m pretty happy with the decision so far, we’ve been in production for close that time and I feel very productive and enjoy it a lot.

That’s not to say we never encounter hiccups, we’ve been bitten by a few libraries getting unmaintained, a few drastic changes in Phoenix in the first years, and a hard time getting a proper deployment setup, but nowadays is much more mature.

Thanks to Elixir we got away with things like not needing to cache (for quite some time) with great performance and with little resources, not worrying about the app becoming slow if 6 people visit at the same time.

Hiring Elixir developers is not as easy as RoR devs but is doable, I had good experience in Elixir specific places like https://elixirjobs.net/ and Upwork to a lesser degree.

Re: Ask HN: Are you satisfied with Elixir or do you regret choosing Elixir?

#192

Earlier quoted context omitted.

Yup. And as illustrated by OP's example links, avoid Stimulus Reflex (NOT stimulus.js) for production too. Apart from the stated reasons, the fact that websocket connections aren't scoped by User by default is a really, REALLY sharp edge!

As far as security is concerned, it's the application's responsibility to properly scope websocket connections... if and when that's appropriate. This is true of any websocket connection, not just those used by StimulusReflex or even ActionCable. As noted by the parent, latency is certainly a consideration when using such tools, but there are a myriad of libs and techniques that can be leveraged to help you build gre…

This is also true of REST requests. They're not scoped to the user by default. In fact, Rails doesn't even have the concept of a user by default.

The argument against using actioncable because it doesn't scope to users by default is roughly akin to arguing against rails in production because rails doesn't even know what a user is by default.

Re: Ask HN: Are you satisfied with Elixir or do you regret choosing Elixir?

#193
post #55

Earlier quoted context omitted.

> Maybe I'm missing something, but doesn't this have precisely the same latency characteristics as live view? There's an open GitHub issue on LV which mentions when using live_redirect you're paying a very large penalty in page load speeds due to extra latency being introduced by LV: https://github.com/phoenixframework/phoenix_live_view/issues... Before this issue existed my non-scientific impression was the same. Th…

Interesting analysis. Do you have any quick examples of site's that use LV? I'm curious.

Not at the moment, but I remember someone posting an example LV page on Twitter a few months ago for pagination and I distinctly remember how delayed the page felt and I pinged 80ms to the server. Basically I've seen scattered examples when they were posted over the years on various social sites.

I'm having a hard time finding a current example demo LV app that demonstrates page transitions using LV or to be honest any sites heavily using LV in general.

But it should be reproduceable in a demo app that uses live_redirect to transition between pages. The issue has repeatable steps and it's been confirmed as a bug by the maintainers of LV, except it looks like it's going to be tricky to solve it.

Re: Ask HN: Are you satisfied with Elixir or do you regret choosing Elixir?

#194
post #54

Earlier quoted context omitted.

Liveview (as well as stimulus-reflex) promote minimal JavaScript by trying to push most interactions to the server, and let the server decide what should change in the frontend. So for example, to show a modal, you send an event that signals the user wants to show a modal, so the backend sends back the html for the modal. You click to close the modal, this sends an event to the backend, the backend sends you the diff…

Yup. And as illustrated by OP's example links, avoid Stimulus Reflex (NOT stimulus.js) for production too. Apart from the stated reasons, the fact that websocket connections aren't scoped by User by default is a really, REALLY sharp edge!

Im a little puzzled by this.

This is essentially like saying "Dont use Rails, the controllers arent scoped to the user by default"

There are plenty of valid reasons to use websockets not scoped to a user. Also how is SR supposed to know your user scheme?

What if you have a multi-tenant app and websockets should be scoped to an account and not a user? Im honestly confused by this statement.

Re: Ask HN: Are you satisfied with Elixir or do you regret choosing Elixir?

#195
post #189
post #166

Earlier quoted context omitted.

>One of the reasons I make a bit of an accusation that the people bedazzled by Erlang/Elixir may be not very experienced is that a common take away from the community I have repeatedly noticed is the belief that if another language doesn't have exactly what Erlang has, warts and all, it doesn't have what Erlang has. On one level yes, they have constructs that you can use to accomplish some of the same goals as the to…

"The concurrency characteristics of the systems I hack on every day would be much harder to model without GenServers. It's not particularly surprising that Erlang is not the only way to solve a problem in software engineering, there is no silver bullet." Erlang was at one point the only way to get this sort of structure, though. Now it isn't. Multiple languages like Go have lightweight coroutine-y type things; if the…

>Erlang was at one point the only way to get this sort of structure, though.

It still is though! Isolated processes with asynchronous, dynamic message passing requires really heavy libraries in most other languages. Rust is completely different, I can't fathom why you'd compare them in this way.

Re: Ask HN: Are you satisfied with Elixir or do you regret choosing Elixir?

#196
post #129

Earlier quoted context omitted.

"Also, I've read some comments where people mention "we don't need redis", "we don't need workers" everything is so much easier. That was our thinking at first. But then you realize on deployments you will lose your cache, or your background jobs, etc. So you have to persist them either in mnesia or in the database. At that point you're just reinventing your crappy undocumented and untested version of delayed_job...…

> But in 2021, you can do not just "better" than Erlang for all of them, you can do much better. Really appreciate the effort that you've put into this post but it's 99% saying you can do better but without examples of stacks that would be better. For those who don't have your knowledge could you provide some examples?

The core insight of Erlang is that having lots of little processes communicating over a message bus is a great way to design code. It also proves by demonstration a statement that many programmers, especially in the past decades, would have found hard to believe, that you can structure code as a whole bunch of relatively small self-contained services. Many programmers, perhaps even today, would not believe how far you can get with such a model, thinking that fairly massive monoliths are still really the only way to scale up.

Rather than specific examples, let me provide terms to google, as these are now such rich spaces that even a list of examples would be impoverish. Google "message bus"; there's half-a-dozen solid production options you can deploy yourself, and all the major clouds have at least one option, often more. Pervasively use a message bus in your architecture and you can't hardly help but end up programming in a very Erlang-esque fashion.

"Database"; no longer is an SQL database over a socket your only option. Some databases even combine a bit of message bus functionality, like Redis, or Postgres.

Restarting and reliability: Process-level restarting of much smaller processes has become popular with things like Kubernetes, Docker, and even just plain ol' Systemd. (This is one place that I will assert that systemd is better than the init.d-based system, which had a solid story on how to start processes but a very ad-hoc one on restarting failed processes.) Internally, consult your favorite language for monitors or restarts within a process; I've got one for Go called suture. Getting an idiomatic restart into a language depends on tons of details and I don't have a good sense of the options across dozens of languages. Note this only really matters if your language and program is handling a lot of things at once in a single process, which is not always the case.

That's most of what would matter, I think. Most of the rest of Erlang like "pattern matching", well, do whatever they do in your language. Which may be pattern matching.

Re: Ask HN: Are you satisfied with Elixir or do you regret choosing Elixir?

#197
post #68

Earlier quoted context omitted.

So what's the recommended approach for doing it without liveview in the liveview world? jquery? just document.addEventListener? That's what hotwire gives you: an opinionated approach and a golden path to do things in a manageable way.

You can use alpine.js. There is even a way to integrate it with LV: https://dockyard.com/blog/2020/12/21/optimizing-user-experie...

response.text()) .then(html => { $refs.dropdown.innerHTML = html }) " @click="open = true" >Show Dropdown

Seriously? This has to be a joke.

Re: Ask HN: Are you satisfied with Elixir or do you regret choosing Elixir?

#198
post #54

Earlier quoted context omitted.

> Specially now we are using all the hotwire stuff. Maybe I'm missing something, but doesn't this have precisely the same latency characteristics as live view? I do agree that some of the "you don't need redis" and similar are overblown (particularly claims about tasks replacing background jobs), but I think there is truth to these claims in the following sense: Particularly in Rails, Redis gets used not just as a to…

Liveview (as well as stimulus-reflex) promote minimal JavaScript by trying to push most interactions to the server, and let the server decide what should change in the frontend. So for example, to show a modal, you send an event that signals the user wants to show a modal, so the backend sends back the html for the modal. You click to close the modal, this sends an event to the backend, the backend sends you the diff…

> In the hotwire world, the encouraged approach would be to already have the html in the dom, and use a stimulus controller to show or hide it

You could also use a turbo-frame here: the modal might contain data that could be expensive to pre-render in the first pass. For example, you have a list of things and you want a modal to show additional details for each thing rather than require navigation to a detail view. Those additional details might need more SQL queries that you don't necessarily want to include in your initial list render, so it makes sense to have that pulled from a separate request.

Closing the modal though should not require another round-trip to the server, that can be done with Javascript.

Re: Ask HN: Are you satisfied with Elixir or do you regret choosing Elixir?

#199
post #195
post #189

Earlier quoted context omitted.

"The concurrency characteristics of the systems I hack on every day would be much harder to model without GenServers. It's not particularly surprising that Erlang is not the only way to solve a problem in software engineering, there is no silver bullet." Erlang was at one point the only way to get this sort of structure, though. Now it isn't. Multiple languages like Go have lightweight coroutine-y type things; if the…

>Erlang was at one point the only way to get this sort of structure, though. It still is though! Isolated processes with asynchronous, dynamic message passing requires really heavy libraries in most other languages. Rust is completely different, I can't fathom why you'd compare them in this way.

Because as I've said, I'm not comparing solutions, I'm comparing problems. Rust solves the isolation problem in a completely different way. Go also solves the isolation problem by enforcing it at a language community and best practice level, rather than rigidly enforcing it in the language. Now, I personally wish it had something more like Erlang or Pony, but, at the same time... it's doing fine without it and completely satisfying my Erlang use cases in real code, better than Erlang did. Not perfectly, but fine. (I rather prefer channels as a default to Erlang's message passing, which in both my opinion and experience has the "unbounded buffer" problem in that messages can build up in a queue forever.)

Message buses solve the message passing requirement. You can get a whole range of solutions from "just sling vaguely JSON stuff around" to "here's a whole strongly typed protocol", with a whole array of options on persistence, clustering, language support, etc., a whole array of options around how synchronous they are and what guarantees they provide, rather than Erlang's one exact solution,

You're kind of demonstrating my exact point here... it isn't that the exact Erlang solution shows up in other languages, the point is that the problem space that Erlang covers is now covered in plenty of other languages, in all sorts of ways, many of them better for some task than Erlang's one point in the space that was selected very, very early in the exploration process. This was not the case 20 years ago. It is now. And I don't particularly think Erlang's coverings of the problem space are the best. People not already deep into Erlang aren't evaluating whether or not some solution is exactly like Erlang, they're evaluating whether the solution is a good solution on its own terms, and once you remove the "must be exactly like Erlang" clause there are a lot of better choices for every element of Erlang, except arguably, the integration of all of them together.

Re: Ask HN: Are you satisfied with Elixir or do you regret choosing Elixir?

#200
post #54

Earlier quoted context omitted.

> Specially now we are using all the hotwire stuff. Maybe I'm missing something, but doesn't this have precisely the same latency characteristics as live view? I do agree that some of the "you don't need redis" and similar are overblown (particularly claims about tasks replacing background jobs), but I think there is truth to these claims in the following sense: Particularly in Rails, Redis gets used not just as a to…

Liveview (as well as stimulus-reflex) promote minimal JavaScript by trying to push most interactions to the server, and let the server decide what should change in the frontend. So for example, to show a modal, you send an event that signals the user wants to show a modal, so the backend sends back the html for the modal. You click to close the modal, this sends an event to the backend, the backend sends you the diff…

Nothing about StimulusReflex pushes you away from this approach. This all comes down to the developer.

StimulusReflex is built on top of Stimulus. The point of SR isnt necessarily to write less javascript, its an easier way to sync client and server state and have a single source of truth.

Use SR where SR makes sense, but just because you have a hammer doesnt mean everything is a nail.

Post reply on HN