Wednesday, November 30, 2005


import * or not

There are two schools of thought on imports in Java. One is explicitly to import each class and the other is to just use a star for every package you import. I fall into the latter school of thought. First of all the compiler doesn't care which way you do it. As long as it has a path to the class it is happy. It is not like an include in C where unnecessary stuff will make your byte code bigger. So the only difference is for readability. When I read code I like to view the imports as a way to give me a general idea of what is going it I am going to read in the class and just knowing the packages is good enough. Too many imports clutters things up when you want a overview.

Comments: Post a Comment

Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?