Two OO ways to design something, curious what everyone's thoughts are? This is w/out context of a framework, just purely OO perspective.

Option 1 - Stateless object w/ Rich Result

Option 2 - Stateful object (e.g. command pattern + internal state to store results)

https://gist.github.com/davetron5000/19aa850df641be6c334e9b64a944b6c8

My thoughts follow, but I am not sure which is the "best" pattern - again all things being equal/not in Rails/etc.

stateful.rb

GitHub Gist: instantly share code, notes, and snippets.

Gist

@davetron5000 we tend to move validation to where end user input is received, and we also tend to avoid result objects unless there truly are multiple outcomes inherent to what the thing does. We don’t use result object states to model malfunctions, for instance. This simplifies the decision.

This is a circumstance where the more correct approach will vary case by case, in my experience. But the reusable approach tends to be more common in practice for us.

@ntl What do you mean "reusable approach”?
@davetron5000 the one whose do_it method accepts input arguments can be reused indefinitely (in contrast to the one that accepts values in its initializer)