3 ms·
> that's why we have things like single responsibilities I would argue that single responsibilities is nice to have. However, OO-style objects are responsible
by yen223 9y ago
> that's why we have things like single responsibilities
I would argue that single responsibilities is nice to have. However, OO-style objects are responsible for both data and behaviour. Object-oriented languages themselves violate the SRP, to its own detriment.
Both functional and imperative languages tend to encourage separation of data and behaviour. I can operate on the same data structure implemented under a different context, without having to bring in its unrelated set of methods. This leads to cleaner code reuse and looser coupling - both nice properties to have in a complex codebase.