by drekipus · 1y ago · 0 comments
I'm coming to Phoenix with a Django background and I really enjoy what I've been messing around with so far, but I haven't done anything serious with it.
When I hear people say "ash is like an orm" then that fills me with dread. I actually come to enjoy how elixir/Phoenix/ecto has done things
If I'm trying to build something ie a news aggregator site (like hackernews ) - how would "make it in ash" help me? If it does things for me, does that mean I lose control of those things? Or they are hidden behind some macro magic that I have to pull apart to get to?
https://alembic.com.au/blog/essence-of-ash-framework
Would love any feedback as to whether this helps allay your fear and dread!
Spark is the DSL library that takes a DSL definition as Elixir structs and builds the DSL for you which in turn takes the written DSL and converts to a standard and simple data structure. So there are fewer macros than you might expect. Ash extensions just introspect that generated data structure with ordinary Elixir code.
The main macro in Ash core itself is the `expr` macro which enables portable declarative predicates which can be used in data layers like AshPostgres for filtering in SQL queries. If your data layer is simple like ETS or a CSV then it runs as Elixir code.
This allows it to reveal the actions of your system externally via GraphQL or JSON API as well as modelling the data for your relational schema (although data layers are swappable and are not always relational).
The data/orm, I usually think of as a lower layer. Then you build domain on top and then interfaces on top of that.
I can see Ash be the middle layer, where you define the domain, (using nouns and verbs) and it pieces together the data and the interfaces.