Hacker News new | ask | show | jobs
by IceDragon200 1639 days ago
For work? Elixir! I particularly enjoy writing tests in elixir compared to any other language so far. Most code is transparent so you can always peek under the hood to see what it's doing, maybe copy a few ideas for your own use. Package management is rather straight forward. The console access in production has been a godsend to execute one off scripts or running export tasks, diagnostics or other bits.

For personal projects? Ruby and Elixir, though ruby's documentation has fallen off of shape as of late, that or Elixir's has spoiled me by setting higher bar

I see you mentioned RoR, you can try Phoenix in its place for Elixir.

1 comments

+1 phoenix/elixir is such a joy to use. A big emphasis on developer happiness, extremely powerful (with a broader set of strengths than Rails imo), and the actor model is much easier for me to reason/think about because it cleanly separates logic and is designed to fail and recover cleanly.
> broader set of strengths than Rails imo

What are those, in your experience? The BEAM platform is certainly better for concurrent work where you might be holding open something like a web socket. But other stuff...? I'm a pretty happy Erlang programmer and feel like I 'get' the functional programming aspect of things, but to me ActiveRecord just feels like such a great fit for DB work in that it makes the simple things really easy and intuitive, lets you do some more complex stuff, and gets out of your way if you just want to go to SQL. I don't have too much experience with Ecto. It feels like it "does the job", but is maybe not quite so quick and intuitive for basic/simple stuff like AR.

Having worked with both ActiveRecord and Ecto, Ecto is consistently easier to reason about and change than AR. It feels closer to the DB without compromising composability, and better avoids surprises. Ecto is IMO one of the killer features of the Elixir ecosystem that is undercelebrated compared to the neat things that are rarely used.
Do you have any concrete examples that you're thinking of?

In particular, I found that having to include all the fields is kind of a PITA compared to AR. I also just find the mental model of an AR object to be really easy to think about in terms of the simple cases. Before save, after save, accessors, and just having methods available on the object all seem really intuitive compared to changesets. Not that I didn't figure those out in short order, they just seemed a bit clumsier. But I am not super deep into Ecto, either, so maybe I'm missing some places where it shines.

It's hard to beat Rails for "need to make a CRUD app in front of a DB". Phoenix is pretty close, though.

Where it really shines is anything beyond CRUD. I want to make my CRUD apps more dynamic, and build collaboration features into otherwise boring apps. LiveView makes it wickedly simple to do things like typeahead find: https://twitter.com/mrkurt/status/1434969788275691522

And Elixir + BEAM gives me reasonable plumbing for collaboration features. Even something as simple as presence makes CRUD apps more powerful.

So the broader set of Phoenix strengths aren't ActiveRecord vs Ecto. Phoenix helps me build a more powerful app because it has a broader set of strengths. And it's almost as good at Rails for just CRUD, so I don't give up much to get those features.