News for hackers. Stuff that matters.
Re:Why Elixir? A Rebuttal to Common Misconceptions by mike1o1 on Wednesday July 23, 2025 @12:27PM (#44661021)
Yes, the learning curve is a extremely high. It took a few false starts over time, but after the "Ash book" came out, I gave it a more serious try and it finally started to click for me.

I think it helped that at the time I was trying to build some pretty advanced filtering functionality using Ecto and was having a pretty tough time. While searching for solutions I saw a few mentions of Ash and that it could solve the problem out of the box.

After a few days of experiments, I found that it was able to do the filtering I wanted out of the box and was even more functional than what I was trying to build.

For reference, I was trying to add some tagging functionality to a resource and I wanted to be able to filter by that tag, including multiple tags. Can I do that in Ecto? Of course, but Ash provided that out of the box after modeling the resource.

Re:Why Elixir? A Rebuttal to Common Misconceptions by pmarreck on Wednesday July 23, 2025 @04:08PM (#44663418)
So if you're comfortable with Ecto and SQL, you can safely skip over Ash?
Re:Why Elixir? A Rebuttal to Common Misconceptions by borromakot on Wednesday July 23, 2025 @06:19PM (#44664626)
That is like 0.5% of what Ash helps with :)
Re:Why Elixir? A Rebuttal to Common Misconceptions by mike1o1 on Wednesday July 23, 2025 @06:42PM (#44664791)
I guess, but you'll be writing a _lot_ of code yourself, that might be hard to maintain and can become brittle overtime as requirements evolve.

As an example, I wanted to add support for adding tags to a resource, and support filtering for the resource by the tag, and I wanted to be able to do this filtering both through Elixir functions as well as GraphQL.

Can I do this with Ecto? Absolutely, but I'd have to build it all myself.

With Ash, I created a `Tag` and `Tagging` resource, adding a `many_to_many` block on my resource, marked it as public. Then I added the `AshGraphql.Resource` extension to my `Tag` resource, marked it as filterable and I was done.

Now I can filter and sort by tags, filter by where tags _don't_ exist and more. I didn't have to do anything other than model my domain, and Ash took care of the rest for me. Not only that, but it probably did a lot of things for me that I probably wouldn't have thought of, such as supporting multi-tenancy, policies and more.

It really is a lovely tool, I can't say enough good things about it.

Does it have a learning curve? Absolutely! Is it worth overcoming it? Again, absolutely!

Re:Why Elixir? A Rebuttal to Common Misconceptions by pmarreck on Wednesday July 23, 2025 @10:07PM (#44666125)
Ah. Looks like I'll have to get the Ash book...
Re:Why Elixir? A Rebuttal to Common Misconceptions by going_north on Thursday July 24, 2025 @03:42AM (#44668047)
Chiming in to recommend it too! The policies are really good too, for instance this is one from our code base:

    policy action(:invite_user) do
      forbid_unless actor_attribute_equals(:role, :admin)
      authorize_if {App.Checks.OnlyAllowedRoles, roles: [:student, :parent]}
    end
And what's nice is that these policies apply for both the API and the frontend code without having to do anything extra :)