On Wed, May 5, 2021 at 8:33 PM Matt del Valle email@example.com wrote:
Creating lots of unnecessary classes just for namespacing, as we currently have to resort to, isn't ideal.
What you're calling 'an unnecessary level of indirection', quickly becomes a big boost to clarity (both in the written code and when using said code in an IDE) in more complex situations. Ask yourself why library authors namespace out the API of their library across multiple modules/packages. It's the same reason.
I absolutely agree that creating lots of classes just for namespacing is unideal. Where we disagree is where the problem is. You think the problem is in the "creating lots of classes". I think the problem is in "needing that much namespacing" :)
That's another reason to go looking for *real* examples. Every example given in this thread can be dismissed for being too simple, while simultaneously being defended as "just an example". Three levels of namespacing just to find one leg out of eight is a complete waste of effort. So.... find us some better examples to discuss, examples that really support your proposal. These ones, as mentioned, are great for explaining/discussing what it does, but not for explaining why it needs to be done.