Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 2
    (not the downvoter) While it's true that shared state is unavoidable at the highest level of any non-trivial application, putting it in a globally accessible ApplicationState object would encourage violation of the Law of Demeter. The highest level of the application should inject the lower level objects with whatever state they need. Commented Nov 27, 2019 at 19:15
  • @NoU, I used to think that, but I've concluded that it isn't true. You are much better off having a single well-defined collection of global state then injecting lots of pieces of state into different things. Commented Nov 27, 2019 at 20:57