It’s better than Java, but they still chose to walk headfirst into the same trap that bites Java developers in the ass: placing the implementations under the concrete type instead of the interface.
When you have two interfaces that each require you to implement a function with the same name but a different signature, you’re in for a bad time featuring an abomination of wrapper types.
Didn’t understand my criticisms of Go and Java’s interfaces, or do you just enjoy LARPing as a senior programmer while living in a small world where the term “interface” strictly means object-oriented programming and not the broader idea of being a specification describing how systems can interact with each other?
I haven’t kept up with recent Java developments, but with Go, you’re out of luck. Interface implementations are—for both better and worse—completely implicit.
It’s better than Java, but they still chose to walk headfirst into the same trap that bites Java developers in the ass: placing the implementations under the concrete type instead of the interface.
When you have two interfaces that each require you to implement a function with the same name but a different signature, you’re in for a bad time featuring an abomination of wrapper types.
Pure oopium. All oop ‘design patterns’ exist solely to overcome the inherent flaws of oop.
Didn’t understand my criticisms of Go and Java’s interfaces, or do you just enjoy LARPing as a senior programmer while living in a small world where the term “interface” strictly means object-oriented programming and not the broader idea of being a specification describing how systems can interact with each other?
On that last note, can’t you use the explicit interface implementation in C#?
e.g.
public class SampleClass : IControl, ISurface { void IControl.Paint() { System.Console.WriteLine("IControl.Paint"); } void ISurface.Paint() { System.Console.WriteLine("ISurface.Paint"); } }
I haven’t kept up with recent Java developments, but with Go, you’re out of luck. Interface implementations are—for both better and worse—completely implicit.
Edit: For Java, it still appears to be that you’re stuck designing around the language: https://stackoverflow.com/questions/19111090/does-java-support-explicit-interface-implementation-like-c
He mentioned C#, which does let you explicitly choose to implement same-name functions of two interfaces with different code
For some reason, my brain inserted a “like” before “in C#”, and answered the question of “can’t you use explicit interfaces like in C#.”