4 ms·
The two biggest problems with OO as it's traditionally used are: 1. Implementation inheritance creates brittle, tightly coupled and difficult to test code. 2.
by cageface 5y ago
The two biggest problems with OO as it's traditionally used are:
1. Implementation inheritance creates brittle, tightly coupled and difficult to test code.
2. Mutable classes force you to structure data updates in a particular, inflexible way. In a world where you're sharing data across multiple clients, serializing and deserializing, using things like Redux to structure updates etc this creates a huge amount of internal friction.
- ipaddr 5y agoThere are things like static classes and functions that can co-exist.
- cageface 5y agoIsn’t a static class essentially just a namespace?
- Jensson 5y agoStatic classes still have constructors that gets invoked to create the static instance. Namespaces doesn't have constructors and instead each member of the namespace gets constructed separately.
- cageface 5y agoI guess it depends on the language but I've definitely had problems with codebases that depended heavily on static initializers. IMO it's usually better to explicitly bootstrap your code.
- Jensson 5y agoMost developers aren't fully aware of how static initialization works so putting it in your code usually isn't a good idea even if you know it, no, but it is a difference between static classes and namespaces.