App development SHOULD prefer simpler concrete types until the abstraction provided by an interface proves necessary. When it does, adding a factory function for a default implementation as outlined above is a source-compatible change that does not require refactoring of usage sites.
mean exactly? Should we not hoist our state with an interface and an implementation like so?
Anthony
08/26/2021, 7:49 PM
This is in the context of writing an app and not a library.
a
Alexandre Elias [G]
08/26/2021, 8:59 PM
your link "so" looks broken so I'm not sure I'm answering the question, but basically the point of the paragraph is that even if you don't start with an interface, in Kotlin you can still swap in an interface later without breaking anything. so there is no need to add an interface if the only reason is "future-proofing"