19788 shaares
136 private links
136 private links
Programmers accustomed to using the building blocks of object orientation (inheritance, polymorphism, and so on) can become blind both to its shortcomings and to alternatives. Functional programming uses different building blocks to achieve reuse, based on more general-purpose concepts like list transformations and portable code. This installment of Functional thinking compares coupling via inheritance with composition as reuse mechanisms, and pinpoints one of the key differences between imperative and functional programming.