A place to discuss and experiment with Hexagonal Architecture in Ruby and Rails
Collective Idea has a neat little gem for rolling up business rules into interactors. Interactors are just "use cases." They should conform to SRP, and can be linked together for multistep tasks.
The gem makes this all very easy.
https://github.com/collectiveidea/interactor
This is similar to "form objects" or resources described by Code Climate and others
Avdi Grim has a great ebook that covers this topic VERY well
http://objectsonrails.com/
In it he references another great article on keeping Rails models thin
http://solnic.eu/2011/08/01/making-activerecord-models-thin.html
Alistari Cockburn's page on Hexagonal Architecture
http://alistair.cockburn.us/Hexagonal+architecture
Robert Martin's talk on Architecture in Rails
Victor Savkin has a good article about combing the above concepts
Obvious is a Ruby lib by RetroMocha that was inspiried by these ideas
http://obvious.retromocha.com/
Ostryalabs has an article on refactoring controllers to be Hexagonal
http://ostryalabs.com/blog/2012/11/27/hexagonal-refactoring-controller.html
Victor Savkin blogs about DCI in Ruby and here discusses decoupling your Rails models from ActiveRecord
Ruby CQRS with event sourcing
https://github.com/slashdotdash/rcqrs
Simple Presentation on CQRS in Ruby
http://holsee.com/the-cqrs-diet-presentation/
An example App in Ruby doing CQRS
https://github.com/cavalle/banksimplistic
See the comment http://stackoverflow.com/questions/6879685/cqrs-in-a-rails-environment on CQRS implementations generally having two databases.
Links from that post
http://www.cqrsinfo.com/
http://www.udidahan.com/2009/12/09/clarified-cqrs/
In his talk Robert Martin recommends the book "Object-Oriented Software Engineering"
In his talk Robert Martin mentions the Model View Presenter Pattern. Martin Fowler has more thoughts about that here.
http://martinfowler.com/eaaDev/ModelViewPresenter.html
Hopefully some day they'll be some code here. ٩(͡๏̯͡๏)۶