4 ms·
The hardest thing for me to get was that Elixir/Phoenix is not Ruby/Rails. They are very different, while syntax is very similar, Elixir favours explicitness un
by adamzapasnik 7y ago
The hardest thing for me to get was that Elixir/Phoenix is not Ruby/Rails. They are very different, while syntax is very similar, Elixir favours explicitness unlike Ruby. This leads to a few more lines of code than in Rails. But in a complicated cases, Elixir's code becomes shorter and much easier to dig in.
Simple case: Adding a new column to a table
Phoenix:
1. Migration
2. update schema
3. update changeset
Rails:
1. Migration
Complex case: Add a new column with validation only on update
Phoenix:
1. Migration
2. update schema
3. update changeset
Rails:
1. Migration
2. add validation with only on update
3. pray it won't break anything in other parts of app :/
The complex case sounds like a simple one, but in a big codebase adding validations could be troublesome for a fee reasons, but let's not dig into them. In Phoenix you can have multiple changeset definitions with different validations for each of them, which makes it much easier to control when and what data is validated.
It's just one of the examples, there are many others...
I'd say, if you are content with Rails, it's great then! No reason to change a technology stack, because some random person is saying it's worth it. If you found a good enough solution for your problems, stick to it :)