Timeline for Why are interfaces more helpful than superclasses in achieving loose coupling?
Current License: CC BY-SA 3.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 8, 2014 at 18:41 | audit | First posts | |||
| May 8, 2014 at 18:43 | |||||
| Apr 30, 2014 at 18:47 | comment | added | Tulains Córdova | Please tell who says superclasses are bad. | |
| Apr 26, 2014 at 22:14 | answer | added | Doval | timeline score: 4 | |
| Apr 26, 2014 at 19:59 | answer | added | amon | timeline score: 11 | |
| Apr 26, 2014 at 19:41 | answer | added | Michael Shaw | timeline score: 1 | |
| Apr 26, 2014 at 19:40 | review | Close votes | |||
| Apr 29, 2014 at 22:33 | |||||
| Apr 26, 2014 at 19:02 | comment | added | keenthinker | It looks like @amon is on the right track, i found this post where it is said that: interfaces are essential for single-inheritance languages like Java and C# because that's the only way in which you can aggregate different behaviors into a single class (which leeds me to the comparison with C++, where interfaces are just classes with pure virtual functions). | |
| Apr 26, 2014 at 18:54 | comment | added | keenthinker | No, i meant costly in terms of the compiler has more to do when it handles an abstract class, but this could be probably neglected. | |
| Apr 26, 2014 at 18:48 | comment | added | Aviv Cohn | @amon So you're saying that the advantage of interfaces over abstract classes when trying to achieve loose coupling is them not being limited by single inheritance? | |
| Apr 26, 2014 at 18:42 | comment | added | amon | Most languages (e.g. Java, C#) that have “interfaces” only support single inheritance. As each class can only have one immediate superclass, (abstract) superclasses are too limited in order for one object to support multiple abstractions. Check out traits (e.g. Scala or Perl's Roles) for a modern alternative which also avoids the “diamond problem” with multiple inheritance. | |
| Apr 26, 2014 at 18:36 | history | edited | Aviv Cohn | CC BY-SA 3.0 | edited title |
| Apr 26, 2014 at 18:27 | history | asked | Aviv Cohn | CC BY-SA 3.0 |