design - designing Java interfaces with ordinary-sounding names, that "play nicely" with other packages -


I want to define an interface called tag in Java code, but the issue of collision Due to the hesitation to use such a simple sound. (For example, you can import only one category or interface with a special name; if there is more than one that shares the same name, then you can use the import for one of them, but the rest will be clear to you Full package name like com.yoyodyne.games.outdoors.Tag)

I do not really have a more detailed name for this (it shows a tag like stacks overflow posts or tags in other online websites is); The closest I might think is taxmoteTag.

What are the strategies to deal with this? The only one I can think of is to define a stable class (like archive ) in which the public interface is tag , e.g. If I call it the classification , then I can import the classification and tag the tag as classification. Tags - but it does not seem very useful.

Edit: This is a widely known example of collision and it is a pain if you are trying to use regular expression with the Glazed List library.

I do not see any problem in giving class tag names, making your package name universally unique And to solve naming conflicts is with one purpose of the packages.

Even within the Java API there are several squares of the same name: java.util.Date, java for example .sql.Date If you need both in your code then completely Use the appropriate name.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -