Roughly ten years ago, Dry RB hit the Ruby scene by ushering in an new way of thinking which embraced the more functional aspects of the language. Granted, Ruby has always supported both Object Oriented and Functional Programming but most Ruby engineers don’t usually venture beyond the basics of Object Oriented design and, even then, these objects tend to be overly complicated and not broken down into smaller, reusable, building blocks for assembling more sophisticated architectures. The blending of both object oriented and functional design is where true power lies.
This kind of architecture is known as: Blended Ruby. This is where you end up after spending a lot of time working in the Ruby language, practicing Shuhari, using Dry RB/Hanami, working in functional languages like Elm, and evolving the craft in general.
There are a few problems. Dry RB was originally architected by Peter Solnica but he’s no longer active within the Ruby community — especially Dry RB, ROM, and Hanami — and hasn’t been for some time. Recently, he made this official by retiring. Peter’s not the only one to leave. Luca Guidi was the architect of Lotus which became what is now known as Hanami. He left Dry RB and Hanami during the middle of last year.
So where do we go from here if you love Ruby and want more in terms of better architecture and design? Well, you could continue venturing down the Dry RB route but the gems are aging and there’s little stewardship (issues can take a very long time to get resolved). Hanami is another avenue but has a lot of rough edges (despite the fact that I recently released Hanamismith 1.0.0 for quick bootstrapping). Hanami issues can also take a long time to get resolved. Roda and Sequel are decent choices too (by the way, ROM is built atop Sequel). Interestingly, Roda/Sequel issues don’t linger long by either getting resolved or closed (if not applicable). This practice is impressive and what I adhere to with all of my professional work.
One solution — and, yes, apologies for tooting my own horn — is to use the Projects (gems) I maintain. These pick up where Dry RB left off by evolving and fixing the flaws of the original design into something much more robust. This is something I’ve been passionate about for several years and always reach for when building new applications or maintaining legacy systems so am excited to share more of what’s brewing for the New Year!
Roadmap
About four years ago, while realizing Dry RB was stagnating, I decided to go down the route of improving these libraries, that I depend upon, by evolving the original design even if that meant breaking compatibility. I tried, at one point, to take on the mantle of stewardship (something I dreamed about often) but was not met with kindness (a story I might share in the future) which took me a year to recover from. Last year, after picking up steam again, I shared my roadmap (as extracted from my Ruby Fusion talk):
With the above, you can see the evolution of the original Dry RB gems to what I now maintain as part of the Alchemists collection. There are gaps and new problems to solve, some of which you can see in yellow, but progress has been steady. The goal of this work — to be clear — is not to duplicate the original Dry implementations but to refine and modernize the functionality entirely (there’s a decent amount of legacy baggage and experimental features that don’t need to be maintained).
One of the problem areas I’m most interested in solving is building a robust monad gem for Ruby. I still use Dry Monads but have been wanting something better for a long time and this year I’ll be focused on that endeavor. Doing this right means I can streamline the design of the Pipeable gem which will lead to more fault tolerant pipelines which is especially critical when dealing with third party APIs, flakey external systems, and poorly designed services with low reliability.
Book
In addition to the work mentioned above, I’m happy to announce that I’ve signed a book publishing deal with The Pragmatic Bookshelf where I’ll be writing a book focused on the following:
-
Functional design patterns.
-
Foundational gems as found via the Projects page.
-
Explaining why this is important for building robust architectures.
-
Teaching you how to apply this functionality to your own applications.
The Pragmatic Bookshelf also has a nice Beta program so you can get early editions of the book as it evolves, ask questions, and/or provide feedback. More on this soon, so stay tuned!
Community
If you are excited about any of this and want to be involved, you can always join the community. I host discussions and weekly moots on a regular basis. I’m generally available and always happy to talk with folks that are deeply interested in blending object oriented and functional design in their own Ruby work.