I am creating a new namespace and the most apt name for one of the class seems to be the same name as the namespace. Is this a good practice? If not, what is the alternative?
For example:
com.person
|--- Person.(java/cs)
|--- PersonDetailChecker.(java/cs)
|--- PersonNameGenerator.(java/cs)
Related questions discussing the same issue:
- Should a class have the same name as the namespace?
- How to avoid having the same name for a class and it's namespace, such as Technology.Technology?
I would try to avoid that, since it can make your code harder to read Eric Lippert has written an article about this, which you can find here:
part 1,
part 2,
part 3
part 4
I've made the mistake myself a few times, and it certainly made it harder to read some of my code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With