We have all experienced moments when our app does not work as expected: Failing validations, libraries raising exceptions, web services becoming unavailable. When this happens, our code ends up becoming defensive against potential failure and overall quality deteriorates. What if we could simplify the process and model our code as a succession of commands, with only success and error paths?
We'll work to refactor bloated logic. We'll extract and group code into meaningful objects called commands. These commands will then be chained to handle success/failure and pass data.
Ruby dev who loves to share and solve problems. Much involved on stackoverflow and current 2nd all time on the ruby-on-rail tag. Working with service objects for a long time, I needed an easy way to handle the error path and to rollback on error. As a result, I wrote https://github.com/apneadiving/waterfall which is meant to answer this need in 200-ish lines of code