I’ve been years in java and kotlin, i don’t really enjoy using “interface” since the usage is often ambiguous. In common scenario i do use “interface” as a contract for open interface. But in general, i do need to define “type” , “pattern/structure”, “interface”. And the longer i code, the more i need “type” or “pattern” instead of “interface”. It (interface) does works for declaring type and pattern, but it ambiguous.
I highly suggest to use “type” since type can contain interface contract, and can also works as pattern declaration.
Im not a fan of inheritance, open class, abstract class, no body does imo. I prefer using pattern and pattern segregation. What is interface segregation anyway.
instead of making dog, inherit to mamal, inherit to vertebrate, inherit to animal.
it’s easier to classify things using pattern and type.
ex: dog should have animal pattern, mammal pattern, vertebrate pattern. and in some level layer we don’t care whether dog is vertebrate or not.
its easier to work with group theory, how we group things, how classification works.
for example in android, if i put streamable contract to a fragment, and send the fragment. how do i know that “streameable” is actualy a fragment without casting it?
but with pattern segregation, let say i have “interface Fragment” all i need to do is to segregate the pattern with “interface Streamable” contract
and now i have interface StreamableFragment: Fragment, Streamable
now i know that StreamableFragment is a Fragment, by pattern recognition.
But since Fragment in android is a open class im unable to do this.
And so, by using “type” as pattern declaration, we force developer to not doing open class or abstract class. but use pattern segregation instead.
I also hate open class and abstract, everybody does imo. why would we modify an object? we r not modifying a fish to become a mammal. why would we do that.
Builder-pattern can do all that. No complicated inheritance needed… Just Pattern and Builder.
this is my opinion based on code experience.