4 ms·
The more local the state is, the easier it is to reason about since less code can reach it. And invalid state is a major source of bugs. And the more global th
by codr7 7y ago
The more local the state is, the easier it is to reason about since less code can reach it. And invalid state is a major source of bugs.
And the more global the state is, the less modular the system becomes, which makes it more difficult to test and adapt to new requirements.
That being said, it's more important to know why than memorizing/following rules, every good decision is some kind of compromise.