3 ms·
Framing this as OOP vs FP isn’t a good framing. Notably in FP you can use first class functions for your area and perimeter functions and experience either side
by throwaway894345 6y ago
Framing this as OOP vs FP isn’t a good framing. Notably in FP you can use first class functions for your area and perimeter functions and experience either side of the “problem”. In other words, a struct with fields for area and perimeter functions is functionally equivalent to the Shape base class in the OOP example.
Ultimately, the problem boils down to language features that give you the option to update a single location or to update many locations, and each situation has its place (for example, sum types are generally less extensible to downstream packages).
- Jtsummers 6y agoThe original framing was OOP vs FP by Wadler himself. https://homepages.inf.ed.ac.uk/wadler/papers/expression/expression.txt https://homepages.inf.ed.ac.uk/wadler/papers/expression/expr...
- throwaway894345 6y agoNo doubt, I'm just arguing it wasn't a very good framing.