4 ms·
Another major issue that isn't called out almost ever is that, at least within the context of an object, member variables and methods are basically global, so y
by colordrops 6y ago
Another major issue that isn't called out almost ever is that, at least within the context of an object, member variables and methods are basically global, so you never know where the state is being modified. This is especially bad in large classes.
- humanrebar 6y agoThat's because OOP advocates presume SOLID principles, including the Single Responsibility Principle.
- hn_throwaway_99 6y agoMeh, I feel that things like "single responsibility principle" are easy to say, but in practice (a) defining what you mean by "single responsibility" is a challenge, and (b) you're often trading off ease of handling things internally within a class for more difficulty in how you have to communicate with other classes (see microservices). I agree though, if your classes are so big it's difficult to keep track of which methods are updating private member variables then that's a good sign your class is too big.
- esperent 6y agoThe problem, then, is large classes. Make your classes small. Single responsibility principle.