▲ 102 ▼ The Tragic Death of Inheritance (avivcarmi.com) submitted 3 years ago by snaggen@programming.dev to c/programming@programming.dev 52 comments fedilink hide all child comments
[–] orangeboats@lemmy.world 4 points 3 years ago (1 child) Composition do not necessitate the creation of a new field like x.reader or x.writer, what are you on? permalink fedilink source parent hideshow 2 child comments replies: [–] dragontamer@lemmy.world 0 points 3 years ago (1 child) https://www.infoworld.com/article/3409071/java-challenger-7-debugging-java-inheritance.html#toc-2 composition is literally the "has a" relationship. That's how its always been taught. permalink fedilink source parent hideshow 2 child comments replies: [–] platypus_plumba@lemmy.world 1 point 3 years ago* (last edited 3 years ago) Man, I honestly have no idea why they are downvoting you. Composition literally means taking common behavior and placing it in external objects behind interfaces using a has-a relationship. No idea why they are denying this. Inheritance vs composition is the same as "is-a" vs "has-a". In composition re usability isn't done via inheritance but code encapsulation. Saying that in Go objects can implement many interfaces is the Interface Segregation principle from SOLID. Basically having small interfaces instead of a big interface with methods that may not be implemented by all implementors. permalink fedilink source parent
[–] dragontamer@lemmy.world 0 points 3 years ago (1 child) https://www.infoworld.com/article/3409071/java-challenger-7-debugging-java-inheritance.html#toc-2 composition is literally the "has a" relationship. That's how its always been taught. permalink fedilink source parent hideshow 2 child comments replies: [–] platypus_plumba@lemmy.world 1 point 3 years ago* (last edited 3 years ago) Man, I honestly have no idea why they are downvoting you. Composition literally means taking common behavior and placing it in external objects behind interfaces using a has-a relationship. No idea why they are denying this. Inheritance vs composition is the same as "is-a" vs "has-a". In composition re usability isn't done via inheritance but code encapsulation. Saying that in Go objects can implement many interfaces is the Interface Segregation principle from SOLID. Basically having small interfaces instead of a big interface with methods that may not be implemented by all implementors. permalink fedilink source parent
[–] platypus_plumba@lemmy.world 1 point 3 years ago* (last edited 3 years ago) Man, I honestly have no idea why they are downvoting you. Composition literally means taking common behavior and placing it in external objects behind interfaces using a has-a relationship. No idea why they are denying this. Inheritance vs composition is the same as "is-a" vs "has-a". In composition re usability isn't done via inheritance but code encapsulation. Saying that in Go objects can implement many interfaces is the Interface Segregation principle from SOLID. Basically having small interfaces instead of a big interface with methods that may not be implemented by all implementors. permalink fedilink source parent