Reputation: 3412
I have a class structure for handset and tablet elements: ProfileFragment(handset) and ProfileFragment(tablet) are derived from ProfileFragment(abstract). Packages go like:
I'm not sure if I'm doing right with those potentially misleading duplicate class names. What would you recommend ?
Upvotes: 1
Views: 122
Reputation: 25755
You should always avoid naming multiple classes (which differ in their implementation) the same. Even though you can (using different packages).
You could go with putting the your device-type in the class name. E.g.
AbstractProfileFragment
TabletProfileFragment
HandsetProfileFragment
Those classes can (and should) still be split up into multiple packages.
Upvotes: 1