Abstractions and reuse

Not exactly, but patterns are not an end in themselves - they simply put a name to a common solution approach for commonly appearing problems. And OO being what it is has a lot of patterns for situations that aren’t easily approached in an OO environment.

So rather than focusing on implementing some pattern in Elixir I think it would be more helpful if you could shed some more light and detail on the actual, concrete problem that you are trying to solve and possibly even expand the scope of the description of the surrounding situation.

Given the information that you have already given @gregvaughn’s approach seems reasonable. My interpretation of his post leads me to a tactic that is often used with behaviours when testing ***.

Given your previous exposure with Mox I expect that you are throughly familiar with this approach to using behaviours. So I can only assume that you still have some misgivings with that particular solution implementation. Can you maybe elaborate on what your residual concerns are?

Edit: (***) as implemented in that post the alternate behaviour is “bound” during compilation. But as described in @gregvaughn’s post Application.get_env/3 can be used to retrieve information to complete the MFA tuples that are necessary to complete alternate function calls with apply/3 (similar to how it was used in your other topic).