y
07/27/2023, 4:56 AMFoo
, 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.voohbar
07/27/2023, 2:18 PM