4 ms·
> why should each class define and own its own methods? State mutations. That's it. By ensuring that your data can only be mutated by a your API, it can never
by snicker7 6y ago
> why should each class define and own its own methods?
State mutations. That's it. By ensuring that your data can only be mutated by a your API, it can never get "corrupted".
- mbauman 6y agoSure, there is a subset of behaviors for which this style makes sense, but it's just as well supported by simply defining your own functions alongside the struct.