woohaaha
I’m coming from Ruby and Rails. I have read some Elixir and Phoenix books. They shed a lot of light about building applications in Elixir. What I’m not clear on is what patterns are promoted for growing Elixir applications. Little things are promoted, as far as I can tell, but it doesn’t get too specific. I’m a heavy book consumer and in Ruby the books that I view as extremely well thought out and thorough include:
Rails antipatterns
99 Bottles of OOP
Confident Ruby
Practical Object Oriented Design using Ruby (POODR)
Refactoring - Ruby Edition
Ruby Science
(and the list goes on)
Are there any books in the Elixir world that cover these topics (design, refactoring) as deeply as these books do in Ruby?
Thank you
Trending in Chat/Questions
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
kokolegorille
Hello, welcome to the forum.
As I also comes from Ruby/Rails I had the same questions when I started
But functional programming is not OOP, no object, no classes, and known design patterns doesn’t apply.
It’s just different.
But You might soon see that functional proramming brings You a lot of safety (no mutation) and a different mindset.
Now, when I write Ruby, I try to apply functional paradigm principles
Here are videos You might enjoy (as I did…)
There is also this recent topic, where some books are recommended…
woohaaha
Thank you!
Sammis
Thank you so very much!
AstonJ
Further to what Koko has said, if you like Dave’s talk you might also be interested in his course: Elixir for Programmers (PragDave) (have a look at the comments/reviews in the thread). It’s not really about refactoring and such, but you do get a look into how Dave goes about architecting software (at least at the time he recorded the course)
kokolegorille
I hope You enjoyed presentations, as they were kind of mind blowing for me.
Here is my 2 cents advises…
And many more that I forget, all of these You can learn on https://elixir-lang.org
The last advise, for Rails developpers, Ecto is not AR, but You can do equal job… (same same, but different) Here is a post about a free resource on Ecto.
FP is just a mean to achieve greater goal, Here is a post from Erlang creator, about Erlang.
Once You reach the syntax barrier, You will see it allows You to have a complete isolation…
In complete isolation, You can have millions of processes working together. Coupled with a faillback mecanism (Supervisor) You can build softwares that are fault tolerant.
Apart from Functional patterns, there are Design Patterns for processes, it’s called OTP.
woohaaha
Thank you. I’ll take a closer look at OTP.
Regarding patterns/refactoring, in OOP there’s the idea of focused objects/little things. This is represented in objects like Services, Policies, Queries, Presenters, Decorators, etc… Are these patterns relevant in the elixir world as well? Doing some Googling doesn’t reveal much.
The beginner examples in both ruby and elixir show much of the examples either in irb/iex or in a Rails/Phoenix controller. This does not scale. In the Rails world I just look up some common patterns and I get a plethora of results. This does not happen with Elixir so I think I don’t know the patterns (and possibly they aren’t even called patterns).
kokolegorille
In FP it’s the same, You just call those things functions. And You compose those functions to make bigger things.
Presenters, Decorators are from OOP, there is no need because functions are highly composables.
Services, Policies, Queries are probably bounded in a module.
Please note that in Erlang/Elixir we have MFA, You will see this a lot.
It means Module, Function, Arguments
kokolegorille
I took the same way You did, just a bit earlier. As You, I read all the Ruby books You mentionned…
I can remember the depressing feeling of not finding the equivalent of what I learned, all those things Sandi Metz was praising… is it just replaced by MFA?
In Ruby, often You find small objects, used for one function only, that could be parser.parse(), presenter.present()… anything like this. In FP You pass a function.
High order functions are so powerful (something Ruby touch with Lambda) that You don’t need Template, or Strategy patterns.
In Erlang/Elixir, we have some famous Erlangelist… this is one of my favourite talk to understand why this difference is so appealing.
He is the author of Elixir in action, and runs https://www.theerlangelist.com/
Qqwy
Have you read Elixir in Action? Much of the book builds on the same example application of a todo system, with increasing complexity (adding a caching layer, persistency, fault-tolerancy, a web interface, and distribution). When I started out with Elixir I found the way this example evolved over the course of the book a really good guideline for how to evolve a real-world Elixir application.
AstonJ
Now that I’ve read (most of) it, it’s worth noting that the Ecto book also has a chapter on application design (covers pure/impure, Contexts, Umbrellas) while of course Programming Phoenix also covers application design in terms of Contexts - I highly recommend both books
Other books not mentioned here that cover app design (that I haven’t read yet) are Functional Web Development with Elixir, OTP, and Phoenix (Pragprog) and Designing Elixir Systems with OTP (Pragprog) and The Elixir Toy Robot (self-published) may also be worth a look