How to Make a Java Package

After a singularly unconvincing lesson on the theory behind packages, there follows one on how to make them. And the opening is not auspicious: "To create a package, you choose a name for the package ... ". Gosh I'd never have guessed that. Never having created a file before, or a folder, or zip file, I'd never have guessed that you have to "choose a name" for java packages.

The level of these tutorials is not consistent. One minute they use undefined terms, and just assume you can work out what they mean. And the next go down to a level which can only be described as inane.

Is it Sun, is it Java, or is it Americans who just can't express themselves in writing. It can't be Americans. I had my doctoral thesis proof read by an American whose English was impeccable. It must be mainstream programmers, who just aren't used to writing in English. The bottom line is that it makes the learning process long, slow and hard.

After reading the opening paragraph fifteen times, the message seems to be that creating a java package involves not so much grouping a bunch of source files into a folder or zipping them into an archive, but rather a "belongs to" statement has to be included in each file. That's OK. It's not something I've had to do manually before, but now I've been told, I'll try to remember it. But why can't it be explained simply, and explicitly?

The second paragraph in the lesson is shorter, clearer, but still amazingly trivial. The "belongs to" statement must be in the first line of the source file, and check this out, each source file can only belong to one package - as if one is used to files having membership of multiple folders or archives!

There follows an insert containing more tangential gibberish, and then we see excerpts from six source files, each with an identical "belongs to" statement in the first line. Two contradictory thoughts arise from this. First do we really need six illustrations of such a simple construct? Second, is that it? Is that all you do to create a package? The location of the files in the local file system is apparently irrelevant? There is no compression or archiving of the source files into a single (dare I say) package? Apparently not. A java package is apparently just a collection of files which share a common opening statement.

Comments

Popular posts from this blog

A few notes on JavaScript

Forum Comments on Java Applets

Creating a Custom Swing Component