I have come from an OOP background with usage of recognized design patterns for large projects that aids in maintainability. However, I am now interested in the blackbox nature of functional programming and specifically Elixir programming. I struggle to find resources teaching patterns for maintainability and readability of a large codebase. The best I’ve seen is references to libraries such as credo, excoveralls, dialyxir, etc. Does anybody know of some book or resource that does a good job explaining how to organize and keep maintainable large functional programming (specifically elixir) projects?
A lot of the topics in OO programming apply just as well in FP. With that in mind, I’d recommend domain driven design by Eric Evans and working effectively with legacy code by michael feathers.
I also come from an OOP background where I regularly use the Resource Action pattern to write Solid and Clean Code but the MVC pattern used for example in Phoenix completely violates it.
I strongly recommend you to take a look to both and see how the approach results in a more clean and decoupled architecture
I second PragDave’s book and course too - his course is one of the best courses I have ever done - here’s my review
This is why the mantra is "–no-ecto’. There’s no excuse for putting any model-related stuff in a Phoenix application, unless you miss Rails…
In terms of “large projects” I don’t think there is anything equivalent to Designing for Scalability with Erlang/OTP: Implement Robust, Fault-Tolerant Systems:
- Chapters 3-4 deals with the process level (for example extracting generic behaviours)
- Chapters 5-7 deals with OTP level details
- Chapter 8 deals with supervision
- Chapter 9 deals with (OTP) applications
- Chapter 10 deals with special processes and custom behaviours
- Chapters 11-12 deals with releases
- Chapters 13-16 touches on various topics pertaining to distributed and unattended system architectures.
Now granted this is all presented in the context of the Erlang ecosystem but most lessons apply to systems built with Elixir as well.
It still boils down to:
- choosing the right boundaries, be it at the function, module, process, or application granularity
- managing the number, kind, and direction of any dependencies
- designing effective collaborations, coordinations, and protocols.
… and when comes to these “principles” and “patterns” it is always important to consider:
“Patterns” primarily establish a nomenclature for some generalized solution approaches as they may apply to certain circumstances with the intent of making communication between developers more efficient, effective and clear. Secondarily they can also serve as case studies for the design guidelines they are based on.