4 ms·
This originally meant relying upon the public declaration of functions and methods rather than implementation details. Over time this has been warped to mean t
by bcrosby95 6y ago
This originally meant relying upon the public declaration of functions and methods rather than implementation details. Over time this has been warped to mean the "interface" keyword in OO languages.
I prefer to code to the non-keyword-interface. Turning everything into a keyword-interface has zero value add and causes a proliferation of shitty keyword-interfaces that are not actually points of extension and polymorphism, which is what keyword-interfaces should be. So I would actually say they add negative value to a codebase.
- tel 6y agoAgree and disagree. As often is the case, once you make an abstract concept concrete in the codebase it gets distorted and exploited. "Keyword interfaces" as you helpfully define here are a prime example. They are not 1-to-1 with genuine "interfaces" as one would like to discuss. More than just the declaration of functions and methods, though, is the way that those functions are known to interact! Consequentially, an interface may infect another interface, at least abstractly. In contrast to what I just said above, I think OCaml has a fantastic "keyword" implementation of interfaces. The whole language is built around it. It's not perfect (there's no way to specify the "laws" between interface elements) but it treats composition of interfaces as a very first class idea. I find myself recommending it all the time.