Re: namespace hierarchy best practices



Ed wrote:
jdeveloper skrev:

Are there best practices guidelines for package or namespace
hierarchies? (other than :don't make too many of them)
Starting with a developer setup.
If I wanna start under my project directory: c:\jwork
what would be the best practices for creating and placing source code
package hierarchies?

There is, firstly, a common practice of reversing your web-address and
using it as the root of your package hierarchy. So if you thinking of
developing a banking system, and your home page is www.jdeveloper.com,
then your package hierarchy will begin (for example):
com.jdeveloper.bank

Besides this, I've also seen package use the name of their project or product as the root of a package. For example, if you make a product for Java developers name SuperLibrary, the your package is named superlibrary, and everything is under there

import superlibrary.supercomponent;
import superlibrary.utils.superutility;

//etc...

Just make sure no one is using the same name, and you'll probably be ok.


As an aside, I've often wondered if there should a convention for people who don't have their own domain names to release under. Let's say you have a project at Source Forge. You could release your package under:

import net.sourceforge.projects.myproject.*;

This would require cooperation from the domain name owner. They should specify where collaborations or codehaus projects get released under their hierarchy, and how an individual project name is determined and made unique. Most codehaus projects already have a way of making the project name unique, so they'd just have to specify where the project is released.

Any interest you think? Or overkill?
.



Relevant Pages

  • Re: Re: cant login as root at the graphical login prompt
    ... >> I checked my Desktop menu in the hierarchy you described but didn't ... >> find the Login Screen tool. ... Could you tell me which package I should ... > Before logging in as user, click session and change from KDE to Gnome. ...
    (Fedora)
  • Re: Adding installed packages to menu
    ... be automatically added to the Applicatopons menu hierarchy, would be that, ... when an extra package is installed on a system, the package, or the ... on completion of the installation; ... application added to the Applications menu hierarchy?", and, if the answer ...
    (Debian-User)
  • Re: Q: Java source and directory structure - standard way ?
    ... > Ah yes, but in Java the package 'hierarchy' is part of the output, so ... The package structure is NOT ... The programmer dictates to the compiler what ... the package structure should be via the "package" directive. ...
    (comp.lang.java)
  • Java package structure
    ... I was trying to explain why I think that one Java package structure is ... Does anyone know of the official Sun recommendation? ... not the mathematical definition of, "Hierarchy," I'm interested in: ...
    (comp.lang.java.help)
  • Re: Updating Ubuntu
    ... installed a Linux package that has not been signed? ... trust each and ever package developer? ... back-hole knowingly in an open source software. ...
    (comp.os.linux.misc)