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

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
xgilarb
Hi there, I’m interested in using Elixir because of the rumors about the reliability of the Phoenix framework, and surprisingly, Elixir’...
New
Scoty
Hey, I am currently reading Programming Elixir and I am doing one of the exercises where you should write a solution to the “I’m thinkin...
New
Yoga
Or at least, in the works? All I can find are bits and pieces but not a single project from start to finish. Including things like i18n,...
New
New
asfand
I am Asfandyar from Pakistan. This is my first time to the forum. I develop PHP websites using CodeIgniter, which is super easy to learn...
New
Chawki
Hi,i’m new to elixir. i’m searching elixir small programs to try it out my self,Is any good resources out there? Thank you.
New
Fl4m3Ph03n1x
GenStage and Flow resources? I have been hearing about GenStage and Flow, a tool built upon it, for quite some time. I understand it allo...
New
AstonJ
It’s been a while since we asked this - I’m sure others (especially newcomers to the language) will be interested to hear how you’ve all ...
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

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
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
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New

We're in Beta

About us Mission Statement