java包结构的反向域名有什么意义 [英] What is the significance of the reverse domain name for java package structure
问题描述
为什么我们使用像com.something这样的反向域名。或者org.something。 java包的结构?
我明白这带来了某种独特性,但为什么我们需要这种独特性?
Why do we use reverse domain name like com.something. or org.something. structure for java packages? I understand this brings in some sort of uniqueness, but why do we need this uniqueness?
推荐答案
全球独一无二的包装名称避免命名来自不同来源的库之间的冲突。使用域名注册表而不是创建全局名称的新中央数据库。来自JLS:
Globally unique package names avoid naming collisions between libraries from different sources. Rather than creating a new central database of global names, the domain name registry is used. From the JLS:
生成唯一包名称的建议约定是
仅仅是一种背包方式
命名约定在
现有的,广为人知的唯一名称
注册表之上,而不是必须为包名创建
单独的注册表。
The suggested convention for generating unique package names is merely a way to piggyback a package naming convention on top of an existing, widely known unique name registry instead of having to create a separate registry for package names.
这篇关于java包结构的反向域名有什么意义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!