My R&D team have Java packages containing classes with the same name. For instance: com.myapp.modelDevice...com.myapp.dataDevice...We had a discussion, the names conflict when both classes are referenced. the following options came up:1st approachRenaming the class and adding a prefix to the class name - ModelDevice and DataDevice 2nd approachUsing the package name when both are used com.myapp.data.Device, com.myapp.model.DeviceDear community,What is more correct in terms of code management and scalability? we are currently mixing both approaches and starting to have inconsistency
How to deal with Classes having the same name (different packages)
java;coding style;coding standards;naming;conventions
Use the package name. This type of problem is precisely why Java uses the package naming convention that it does. It prevents these sorts of problems, whether it's two teams in the same company or two teams on opposite sides of the earth.