2 ms·
Static classes and singletons just tell you that the people who shoehorned everything into an OOP paradigm in your language of choice were mistaken, because the
by JulianMorrison 13y ago
Static classes and singletons just tell you that the people who shoehorned everything into an OOP paradigm in your language of choice were mistaken, because there are plenty of things that are simpler and clearer as top level functions and data.
- mikegioia 13y agoI think you're right, but wouldn't the alternative then just be namespacing all of your top level functions into separate files? It seems that a static class of related functions is just another way to organize top level functions.
- pmelendez 13y agoIt really depends. I had used singletons when wanted to manage a resource using RAII and have to be easily available across all the applications. My canonical example would be writing on a log but YMMV.