woohaaha

woohaaha

Elixir design and refactoring books

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

Most Liked

kokolegorille

kokolegorille

Hello, welcome to the forum.

As I also comes from Ruby/Rails I had the same questions when I started :slight_smile:

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 :slight_smile:

Here are videos You might enjoy (as I did…)

There is also this recent topic, where some books are recommended…

kokolegorille

kokolegorille

I hope You enjoyed presentations, as they were kind of mind blowing for me.

Here is my 2 cents advises…

  • pattern matching is THE thing
  • |> creates beautiful and descriptive transformation pipeline
  • The Enum module is a must
  • Lists are not arrays
  • Polymorphism can be achieved via protocols

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.

kokolegorille

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/

peerreynders

peerreynders

Let’s not forget that BEAM languages also enable CP - Concurrent Programming. The core pattern is a behaviour (see also discussion).

Garret Smith had an effort some years ago to capture some Erlang Patterns which are still available in some markdown documents here - the mostly apply to Elixir as well.

Cruz

Cruz

Hi,

Just trying to complement what others have already mentioned. I found this book about functional programming very useful for someone with an OO background:

https://pragprog.com/book/cdc-elixir/learn-functional-programming-with-elixir

And, if you really want to know more about design patterns in functional languages, this other one provides examples in Scala and Clojure:

https://pragprog.com/book/mbfpp/functional-programming-patterns-in-scala-and-clojure

However, I think you better off learning the basics of FP and move where your interests take you. You’ll be amazed at how much you can accomplish with just modules and functions.

Where Next?

Popular in Chat/Questions Top

New
svetarosemond
I’m planning on purchasing Elixir in action second edition, and I was wondering if anyone could tell me based off the first edition, does...
New
TwistingTwists
I want to learn DSL. Don’t know how to write one. What;s the best introductory resource? I see some macro being used here. Is DSL only ...
New
stevensonmt
I’d like to provide my review of the Elixir Course module from Groxio. I have some criticisms but I’d like to start with the positives. ...
New
Besto
I've been trying to start learning Elixir for a couple of weeks while I develop a tiny project I have on node.js, but every time I try to...
New
lgmfred
Hello, I want to get started with elixir today. Having learnt the basics of Erlang (my first ever language) and seen what it’s can do, I’...
New
Sujit
Hi Team From the title, I am entirely new to programming and i am interested in learning elixir but not sure where to start. Can someone...
New
Fl4m3Ph03n1x
Background After following the communitiy suggestion, I bought the Elixir in Action 2nd Edition book and I am about to finish it now. I ...
New
younes-alouani
I'm studying Phoenix Framework but I want to understand basics first. Which book/mooc explains better the Design of Network-based Softwar...
New
Fl4m3Ph03n1x
Background Hey guys, recently I bought a book on TDD that I am reading. The books is really nice and has some really juicy things on arch...
New

Other popular topics Top

chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

We're in Beta

About us Mission Statement