Re: Package naming, disk organization
Dave wrote:
I'm having fun with Java (really!), but the real-world use of packages
is driving me crazy. If I were a corp. with a web site I might have a
something like this: org.davesjava.firstlgproj for a package
specification. I guess the disk drive files would be something like:
home/org/davesjava/firstlgproj (I use Linux, so there are no '\').
The disk drive organization in most Java implementations matches the package
organization, rooted at a directory mentioned in the class path.
However:
* I don't have a commercial organization (yet), so I would need
Irrelevant, as others have told you. Use the domain you would have if you had one.
Who says you have to have a commercial organization to have a domain?
Who told you you had to have a domain to use it as your package name? The only rule
is that you cannot use someone else's.
something else - but what? Would jsoft.davesjava.firstlgproj be ok? It
The first element should be a top-level domain, like "com".
Do not use the word "java" in your package names. What's the point? If it isn't
Java it isn't in your Java program. Also, "Java" is trademarked.
seems to work for one trial, but down the road...
What exactly do you fear?
What evidence led you to that concern?
* I read that Java programmers like to have a source path and a class
Huh?
Java programmers don't "like" anything. We do what the platform calls for.
path on the hard drive, which makes sense. So how does that work for
package specifications? Would it be: src/jsoft/davesjava/firstlgproj
Is "src" in your classpath or sourcepath?
and class/jsoft/davesjava/firstlgproj ? Assuming so, would a package
Is "class" in your classpath or sourcepath?
The first element of your package name by convention should equate to a TLD.
Use "com", typically.
specification of jsoft.davesjava.firstlgproj still be ok?
* There is a conflict between a simple file structure and a conventional
package specification. For example, I may like:
No, there isn't.
home/jsoft/src/firstlgproj and home/jsoft/class/firstljproj , but that
translates into jsoft.class.firstlgproj - not exactly to convention.
Don't use "class" or "package" or "java" or any garbage like that in your package names
unless there is a specific semantic to the use of the term. The fact that there are classes
in a package does not need reinforcement in your names. It only serves to add clutter to
do that.
So, I'm looking for some suggestions from people that have been there
done that.
What does the documentation suggest you do?
--
Lew