Settings

Theme

Composition Over Inheritance – Object Oriented Programming

variadic.me

4 points by shintoist 12 years ago · 1 comment

Reader

collyw 12 years ago

Read the article, then wikipedia to see why the preference. Yes, I can see that composition can leave you a more flexible model, but at the same time inheritance could save you a fair bit of coding. And less code is less likely to have bugs (though probably composition code is fairly straight forward). I guess use each where it is appropriate.

http://stackoverflow.com/questions/56860/what-is-the-liskov-...

The stack overflow answer seems to be a good guideline.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection