- Start class names with a verb;
- Public contract is a
#callmethod;- Enables SRP;
- Enables composition;
- Enables polymorphism;
- Enables to receive Proc/callables objects;
- Receive stateful/impure functions through the object initializer;
- This permits easy mocking/substitution.
- Receive pure function inputs through the
#callmethod; - This resembles curry-like functions;
- The
#callcalling always returns a value, preferably 'result'-like objects;- This avoids 'primitive obssesion' anti-pattern;
- Consider monadics operations;
- Define stateful/impure functions as default implementation, in case nothing is received;
- Stateful/impure functions are always returned as closures/lambda;
- Object state is uded only for atateful/impure collaborators.
extract_utm_campaign_value_from(url) # is pure
get_page_title.call(url) # is impure- Message passing is natural;