3 ms·
I use inheritance only if the model satisfies the Liskov Substitution Principle and if the language has strong OO primitives. Functional languages accomplish si
by Cieplak 9y ago
I use inheritance only if the model satisfies the Liskov Substitution Principle and if the language has strong OO primitives. Functional languages accomplish similar goals with different abstractions, e.g., type polymorphism, pattern matching, functional composition.
- Cieplak 9y agoAs an example, working in the payments business, we often model credit cards and bank accounts as different subclasses (or types) of a common superclass, given that these objects share a lot of semantics, i.e., they both send and receive payments.