at work we use this pattern for certain classes where instead of having a single concrete class
Foo
, we moved all the method definitions into something like
interface FooInterface
.
all the methods return
Unit
and have an empty default implementation defined in the interface.
then we have a
FooFactory
which (depending on some external setting) returns either a
class Foo
with overrides for each method, or a
object DummyFoo
, which doesn't override (and so has empty implementations for all the methods).
I understand what this pattern is trying to achieve, but is there an alternative? I really don't like it. especially as
interface FooInterface
keeps getting more and more methods, and becoming more and more specific.