3 ms·
> - High memory usage There is nothing about OO does enforce higher memory usage compared to other patterns. In fact it might be better than functional program
by Matthias247 4y ago
> - High memory usage
There is nothing about OO does enforce higher memory usage compared to other patterns. In fact it might be better than functional programming, which relies on a lot of closures (which all need heap allocations). The fact that Java does not support value types will require more memory for a certain set of applications than e.g. Go or C# - but that is barely related to OO.
> - It's harder to visualize a OO codebase than a pure FP codebase like Haskell.
This will be rather subjective. Be sure to have a common understanding with your team about it if you are not the only contributor to a codebase.
- pkolaczk 4y ago> There is nothing about OO does enforce higher memory usage compared to other patterns. Many OO languages offer dynamic/virtual dispatch of methods as a primary (and sometimes only) way to do polymorphism. This comes at a non-zero memory cost, because each object needs some additional runtime type information. > In fact it might be better than functional programming, which relies on a lot of closures (which all need heap allocations) Closures do not need heap allocations. Rust has closures and allocates them on the stack (unless you deliberately box them). I don't know Haskell, but I believe it could do the same.