4 ms·
Almost assuredly better managed. There are no reasons to manage state on the global level apart from laziness.
by lightbendover 5y ago
Almost assuredly better managed. There are no reasons to manage state on the global level apart from laziness.
- AussieWog93 5y agoFunny you should mention that. I've used ocornut's ImGui library in the past, with a single, hierarchical object that managed the entire GUI state. This approach caused whole classes of problems that affect regular GUIs to simply disappear, and it was the most performant, least buggy UI I've ever written by a country mile.
- ioseph 5y agoIsn't Redux doing this exact thing?
- hnlmorg 5y agoSweeping statements like that are the real laziness. All it proves is that you lack diverse experience in software development. I'm a big advocate for functional programming but even I have to concede that in some domains, and particularly in some languages, when you're having to manage universal properties those properties are sometimes best placed at a global level.
- Chris2048 5y agoIt's quite common in python to manage/encapsulate a global by wrapping it in a module, so arguably a singleton is the same thing, just encapsulating in a class/class-instance instead? but even if the prog-lang had specific support for safe(r) globals, it would still just be a global at the lower (higher?) level.