开发者

why people use org.proj.subproj in most of java libs [closed]

Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update t开发者_Go百科he question so it can be answered with facts and citations by editing this post.

Closed 3 years ago.

Improve this question

I wanted to go through java project publishing cycle and I've noticed people mostly use "org"."projectname".etc so i was wondering about this style advantages and why org is very much common ?

A Book or tutorial of such stuff would be great.


It is amazing what a simple search like "java package naming conventions" can yield in Google.

  • Java Package Naming Conventions by Wikipedia.
  • The Java Tutorial: Naming a Package
  • Java Language Specification: Unique Package Names


org. is commonly (though not always) used for open source projects because they are released in a not-for-profit way. However, within companies you will find a lot of code using com.companyname, or even just companyname. or projectname. (the latter two styles are not recommended.) So I don't think it's true that "most people" use org - that's just what it looks like because you can't see all of that private company code on the Internet!

The reason for all this is that Sun, the company that created Java, recommends that people put classes in packages named after their domain name, reversed, and create subpackages within that to be unique within their organisation. The purpose is to avoid name clashes. That is why apache packages start with org.apache, for example - because apache's main domain name is apache.org.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜