Re: Please recommend a book
David Lamb wrote:
It seemed to me his problem was understanding something that depends on
a gazillion imports, not managing the imports themselves.
I'm having difficulty how the number of imports impacts the clarity of the code.
Imports aren't part of the logic; they simply allow abbreviated names for types
and type members.
Now if code is hyper-complex and depends on too many other types, that is a
structural or architectural problem with the code itself, and not with Java /per se/.
But is a "zillion" really above that threshold?
How much is the OP's "zillion"?
Anyway, the dependency question is easy. If a method needs a capability provided
by another module (i.e., class or interface), it depends on that. That's true of every single
modular computer language there is, and not unique to Java.
Example: If you write a Swing program that uses a 'JPanel' (a type of window widget), then
that program depends on 'JPanel'.
The imports provide a very simple and compact description of the dependencies, if imports
are used. They are optional, after all. But otherwise the FQNs (fully-qualified names) of the
constructs provide the same information.
The OP seems to be complaining about hard programs, not a hard programming language.
Java is really dog-dirty simple as a language.
The question of dependencies is one the OP had better master as a programmer generally,
because like other fundamental programming skills it's necessary for Java programming, too.
--
Lew