3 ms·
I thought composition vs inheritance was strictly an OO, not a functional thing?
by voltagex_ 13y ago
I thought composition vs inheritance was strictly an OO, not a functional thing?
- profquail 13y agoFunctional programming usually leans towards composition, and OO programming towards inheritance. "Hybrid" functional languages, like F# and Scala, allow you to use both styles, mixing them in whatever way is most useful for the particular problem you're solving; "pure" functional languages, like Haskell don't offer OO-style inheritance, since composition is a better fit for combining side-effect free ("pure") functions. tl;dr -- Composition is to functional programming as inheritance is to OO programming.