I did work at one company where they had many classes with the same name, but in different class libraries.
For example,
- Domain.Customer
- Legacy.Customer
- ServiceX.Customer
- ViewModel.Customer
- Database.Customer
Bad design, you might say, but you know how these things develop organically, and what's the alternative - rename all the classes to include the namespace? Major refactoring of everything?
In any case, there were several places where projects which referenced all these different libraries needed to use multiple versions of the class.
With the using
directly at the top, this was a major pain in the arse, ReSharper would do odd things to try and make it work, rewriting the using
directives on the fly, you would get Customer-can't-be-cast-as-Customer-style errors and not know which type was the correct one.
So, having at least the partial namespace,
var cust = new Domain.Customer
or
public void Purchase(ViewModel.Customer customer)
greatly improved the readability of the code and made it explicit which object you wanted.
It wasn't a coding standard, it wasn't the full namespace, and it wasn't applied to all classes as standard.