Reputation: 2240
I understand that I can import packages and get access to lots of already coded classes that I can use to make my programs. But if they give you access to so many different features, why not just import them all? I understand that there are thousands of imports and I know it is uncommon to do so (I don't know of anyone that does it but maybe i'm wrong) but why don't people just import them all? Would it make the program too slow? Or just be inefficient? I'm just curious. Thanks.
Upvotes: 4
Views: 3903
Reputation:
It makes your code unreadable because the person who is reading doesn't see your intentions.ALWAYS REMEMBER: "code is written once, twice maybe more, but hundreds of times read by someone. Example:
In Android SDK there are classes that has the same name but they come from different packages. I think that was GPS location manager or something. Whatever...other programmer could have difficulties, because he needs to think or manually check which import are you using.
I'm not a advanced programmer but I surmise that the output program might be bigger in size.
Upvotes: 1
Reputation: 664
Importing all packages will;
where this list can be extended.
Upvotes: 4
Reputation: 160
There's a few reasons besides speed I can think of:
Upvotes: 6