Has it made code more maintainable and easier to change?
Is the complexity and indirection worth it?
In some places, itās definitely been worth it. If you page through the Git history, you can see some interesting examples where we were able to introduce functionality by only writing new classes. It makes it very easy to layer things in and remove them, or conditionally apply logic. It also generally makes it easier to achieve separation of concerns. Reusability has been fairly easy, and performing large changes and refactorings has been better than usual.
That being said, there are some issues with it.
The current upcase-exercises repository has all its dependencies wired together in a single file, which is getting rather large, even though the project isnāt crazy complex. Iāve played with some ideas around namespacing and modules, but havenāt been able to apply them successfully yet.
Thereās some lingering confusion around the service vs factory ideas. The decorator concept we have in there right now doesnāt seem very powerful, and I think it causes more problems than itās worth.
We experimented with exposing the request to the dependency configuration file, and I consider that to be a failure. Iād like to remove that and try some other ideas instead.
Bottom line: if youāre interested in SOLID or dependency injection in general, Iād recommend giving it a shot. However, I donāt think Payload has proven to be good or bad so far.
Tangent: although Iāve found SOLID to fix a number of issues in the class-based approach used by most Rails applications, the additional complexity required to decorate simple behaviors has increased my desire to explore new approaches like functional composition. Using SOLID was nicer in some ways, but I still hope thereās something much better out there.
That was my initial concern, it felt like CanCanās ability.rb file. The one for our API is monstrous!
Iām at the point where a lot of my controllers just line up dependencies, so it feels like Iām ready to give an IoC container a chance!
Iām also interested in functional composition, the idea of piping data through many objects (ala unix) sounds great to me. Thereās a talk by @jessitron thatās worth a look for anyone interested