Domanda

If I am sat at work I can easily write some java code - I just use my companies domain name as the package name and I do so without even thinking.

If I am sat at home and I don't have a domain name what do I use for my package names?

The JSL doesn't say - it recommends using an Internet domain name. It does, however, mention local and casual package names

This section specifies a suggested convention for generating such unique package names. Implementations of the Java platform are encouraged to provide automatic support for converting a set of packages from local and casual package names to the unique name format described here.

I've not come across anything that does this converting of package names before and I'm not quite sure how it would work in practice.

So, my question is twofold: what package naming should I use if I don't have a domain name and if I go the "local" or "casual" route what is the converting mechanism?

È stato utile?

Soluzione

Use any more-or-less unique name like name of the project or you own name-surname. Domain is just a convention, used to prevent clashes.

Altri suggerimenti

dbf is correct regarding naming convention. To perform package name conversion simply use a modern IDE such as IDEA or Eclipse which contain refactoring options to migrate classes to different packages.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top