27

I just know only naming convention of variable, constant, method... but I don't know naming convention of project and package. Anybody can help me ? Addition, name of project should have white space ? Thanks very much !

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
sharaidana
  • 1,151
  • 2
  • 10
  • 5

1 Answers1

26

In Java, package names are lowercase, no spaces. See http://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html

You probably don't have to be so fussy with the project names. My recommendation is PascalCase, although I've seen some like this one that are camelCase (which I find odd). Sun just uses capitalized phrases for their project names.

Kwadz
  • 2,206
  • 2
  • 24
  • 45
Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
  • Just wondering, is java.about.com good reference? I'd expect something like xyz.oracle.com nowadays, for example http://www.oracle.com/technetwork/java/codeconv-138413.html (but there is nothing about package naming conventions), in this tutorial it's defined properly - http://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html (of course your answer is quite old, so those documents probably didn't exist before) – Betlista Oct 11 '13 at 12:59
  • Project names could be a part of URL for requests. In this case hyphen separator is recommended by SEO. Isn't it? – Zon Mar 24 '20 at 06:35
  • @Zon: I doubt it. That advice is probably outdated. – Robert Harvey Mar 24 '20 at 13:49
  • You can find an example in the URL of this page. – Zon Mar 25 '20 at 04:59
  • @zon: Well, sure. But the presence of hyphens isn't necessarily an endorsement for SEO technique. You're confusing correlation with causation. – Robert Harvey Mar 25 '20 at 12:49