Re:Ask HN: How often do you use inheritance?
by Cieplak on Saturday May 13, 2017 @12:07AM
(#14329488)
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.
[ Parent
| on HN ]
Re:Ask HN: How often do you use inheritance?
by Cieplak on Saturday May 13, 2017 @12:13AM
(#14329501)
As 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.