2 ms·
Using interfaces everywhere might increase future flexibility, but it comes across as (a) not accepting the idiomatic way of programming in Java, C++, Rust, or
by TimTheTinker 4y ago
Using interfaces everywhere might increase future flexibility, but it comes across as (a) not accepting the idiomatic way of programming in Java, C++, Rust, or C#; and (b) a form of premature optimization (which according to Knuth is the root of all evil, as we all know) -- a lot like premature abstraction.
Duck typing is great, but interfaces everywhere isn't necessarily the answer in non-duck OO languages.
- hderms 4y agoYou could falsely negate a bunch of things by claiming it's premature optimization if you expand it's definition to mean thinking in advance. That being said I agree with you that interfaces for literally everything is a bad idea. Especially depending on interfaces everywhere, given that it's often quite nice to know concretely what some piece of code is trying to do. The original post isnt super clear to me regarding how often the author actually recommends using interfaces. The examples used are for storage backends in projects like Kubernetes, which most people would probably agree is a pretty good context in which to utilize interfaces.