Timeline for Should I force "composition over inheritance" rule to class members?
Current License: CC BY-SA 3.0
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 2, 2018 at 18:19 | comment | added | TheCatWhisperer | @JacquesB Some people survive jumping off a cliff, but jumping off a cliff is still a bad idea. I've not seen examples of compositional typing causing coupling problems | |
| May 2, 2018 at 17:08 | comment | added | JacquesB | @TheCatWhisperer: So you argue against using inheritance in one case because it would be inappropriate in another different case? There is no golden hammer which is the correct tool for everything. I'm sure you can also find people misusing composition. | |
| May 2, 2018 at 16:50 | comment | added | TheCatWhisperer | Fine, there are some cases where inheritance is fine, but this is sure not one of them! What happens when you need a Bird class? Are you going to add a fly method to animal? "Of course not" you reply. But then what happens when you need to add a bat? Just say no to inheritance, it is not worth it. It is too hard for 99% of people to discern when or when not it is appropriate. | |
| Jun 1, 2017 at 12:03 | comment | added | Walfrat | @gnasher729 Cargo-cult programming or silver bullet. | |
| Jun 1, 2017 at 8:36 | comment | added | gnasher729 | @arno so you are telling me I cannot inherit from UIView? Dogma hurts. Don't advocate blind obedience to dogma. | |
| Jun 1, 2017 at 8:34 | comment | added | gnasher729 | @arno Something very wrong with comments that don't take common sense into consideration. | |
| Jun 1, 2017 at 7:32 | vote | accept | ggrr | ||
| Jun 23, 2016 at 8:33 | comment | added | JacquesB | @DavidArno: The phase "Favor composition over inheritance" is from the GoF design patterns book, I believe. They certainly does not say you should never use inheritance. | |
| Jun 22, 2016 at 11:14 | comment | added | David Arno | even when used "appropriately", inheritance causes all sorts of problems around creating coupling, including the dreaded "fragile base class problem, weakening encapsulation and making testing harder. Have a read of "Inheritance: just stop using it already" | |
| Jun 22, 2016 at 11:03 | history | edited | JacquesB | CC BY-SA 3.0 | added 568 characters in body |
| Jun 22, 2016 at 10:58 | comment | added | JacquesB | @DavidArno: There is something wrong with inheritance used inappropriately. But this is the same with any feature. | |
| Jun 22, 2016 at 10:44 | comment | added | David Arno | "There is nothing wrong with inheritance" -1 for that.This is an untrue statement, as there is LOTS wrong with inheritance. | |
| Jun 22, 2016 at 8:49 | history | answered | JacquesB | CC BY-SA 3.0 |