4 ms·
import edu.syr.pcpratts.<asterix>; The only reason you see the fully qualified class names is because the IDE does this automatically for you. If there were no
by taligent 14y ago
import edu.syr.pcpratts.<asterix>;
The only reason you see the fully qualified class names is because the IDE does this automatically for you. If there were no IDEs everyone would be using the *s;
- nradov 14y agoWildcard imports are a bad idea regardless of whether you're using an IDE or not due to the risk of future name conflicts.
- taligent 14y agoMy point was more than Java namespaces can be easy to use. Pretty much everyone uses an IDE anyway so it's not like namespaces are ever an issue unless you do come across that rare name clash.
- lloeki 14y ago> Pretty much everyone uses X anyway so it's not like Y are ever an issue This 'its good enough, and everyone does it anyway' attitude leads us to incredibly damaging status quos.
- Karunamon 14y agoOften though, "good enough" really is good enough. You can spend untold man hours trying to get that last little bit of perfection and never really achieve it anyways.
- mateuszf 14y agoThey are not a bad idea if you use and IDE and not an editor. IDE lets you find usages of a type instantly. Anyways such conflicts are rare.
- jburwell 14y agoThis sentiment is dogma from long ago when there was a slight performance improvement for individual imports. Today, there is no such performance advantage. Their risk of a namespace collision, but in practice, it is very rare and very easy to identify when it does. The main reason it remains is mainly due to default IDE configuration. On the flip side, wildcard imports make coding much more fluid and concise. How many times have you had to hit ctrl+space two or more times in the same declaration to add import statements for interfaces and classes from the same package? IMHO, explicit imports greatly decrease the usefulness of the static import feature.
- nradov 14y agoThere has never been any runtime performance difference between individual and wildcard imports. Compiled byte code is identical.
- hythloday 14y agoName conflicts are a compile error - the worst thing that can happen is that you have to change it back to an explicit include.
- hnriot 14y agoTrue iff the code cannot be modified (say for example it's packaged in a jar and is closed source), otherwise this is trivially worked around on the very few times it ever happens.
- nradov 14y agoThis issue is irrelevant for jar files. Compiled byte code contains fully qualified class names, not import statements.