4 ms·
This is exactly what my argument was against. Why make it complex when a simple global would do? Why say GlobalSingleton::var when global $unique_var would do,
by chime 16y ago
This is exactly what my argument was against. Why make it complex when a simple global would do? Why say GlobalSingleton::var when global $unique_var would do, as long as the app does not abuse these global vars?
- DjDarkman 16y agoIt's a few lines of code, I would not call that complex. And the usage is. GlobslSingleton::set('Something Meaningful',$unique_var); and GlobslSingleton::get('Something Meaningful'); I don't think this is complex at all. This doesn't force you to use $unique_var as a variable name(I know it can be worked around). One of the biggest problem with globals is that they can crash and burn if someone else's code purges it by accident. Also my pattern allows 'load on demand', I can incorporate it in if I'd want to, your does not.