(a.k.a. composite reuse principle). Prefer composition (i.e. a class containing an instance of another class) over inheritance (i.e. "extends" or similar)
Think in terms of what an object can do as opposed to what an object is:
"HAS A" vs "IS A"
Benefits are more flexibility, easier thought processing and longer-term stability of objects
(a.k.a. composite reuse principle). Prefer composition (i.e. a class containing an instance of another class) over inheritance (i.e. "extends" or similar)
Think in terms of what an object can do as opposed to what an object is: "HAS A" vs "IS A"
Benefits are more flexibility, easier thought processing and longer-term stability of objects