Hacker News new | ask | show | jobs
by thibaut_barrere 2540 days ago
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).

1 comments

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.

Phoenix LiveView is basically server side rendering in real time.

The user's actions are sent to the Backend via WebSocket, and the Backend rerenders (parts of) the view and sends them to the user.

But ... why? Sends it back as ... HTML?
Not really, the frontend caches the static parts of the template and the backend only needs to resend the dynamic, changing, parts.

So "Welcome to $mysite, $username." would initially send the full rendering but if the data changes it would only send "Hacker News,lawik" over the wire. Somewhat simplified.

This covers it quite well: https://www.youtube.com/watch?v=8xJzHq8ru0M

pretty much like .NET Blazor and SignalR