TLD 优先的类域标识符有何意义?

发布于 2024-09-17 20:44:07 字数 448 浏览 4 评论 0原文

“TLD-first 类域标识符”虽然拗口,但这就是我能想到的全部。

多年来,我在不同的地方看到过这些用法,并想知道这个约定背后的历史/原因是什么,因为您可能会认为有一种真正的方式来提及域。

我不使用 Java,但我通过探索发现命名空间通常是这样完成的:

uk.co.tophats.stitchkit

Mac OS X 上“启动代理”的规范文件:

ws.agile.1PasswordAgent.plist

Mac OS X 上的首选项文件:

com.apple.iTunesHelper.plist

为什么 TLD 放在第一位?它只是像英国与美国日期格式一样的分层迂腐吗?

"TLD-first domain-like identifiers" is a mouthful but that's all I can come up with.

I've seen these used in various places over the years and wondered what the history/reason behind this convention is, since you might be forgiven in thinking that there is one true way to mention a domain.

I don't use Java but I recall from poking around that namespaces are often done like this:

uk.co.tophats.stitchkit

A specification file for a "Launch Agent" on Mac OS X:

ws.agile.1PasswordAgent.plist

A preferences file on Mac OS X:

com.apple.iTunesHelper.plist

Why is the TLD first? Is it just hierarchical pedantry like UK vs. US date formats?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

下壹個目標 2024-09-24 20:44:07

对于 Java 的情况,包直接对应于目录层次结构,并且目录层次结构以最通用的域标识符为根更有意义,而不是最具体的域标识符。此外,在读取目录层次结构时,最常见的是从上到下读取。所以我想说翻转域组件顺序的约定在那里是有意义的。

For the case of Java, the packages correspond directly to directory hierarchy, and it makes far more sense for the directory hierarchy to be rooted at the most general, rather than the most specific, domain identifier. Also, when reading off directory hierarchy, it is most common to read it from the top down. So I'd say the convention of flipping the order of domain components makes sense there.

转角预定愛 2024-09-24 20:44:07

在 Java 和其他编程语言中,包标识符指示项目的目录层次结构如何。

因此,如果您有两个包 com.stackoverflow.servercom.stackoverflow.client,您最终将得到以下目录布局:

com/
   stackoverflow/
      client/
      server/

这是良好且合乎逻辑的,而其他方式会给你带来

client/
   stackoverflow/
      com/
server/
   stackoverflow/
      com/

这是不切实际的。

In Java and other programming languages, the package identifier dictates how the directory hierarchy of the project is.

So if you have two packages com.stackoverflow.server and com.stackoverflow.client, you'll end up with this directory layout:

com/
   stackoverflow/
      client/
      server/

which is good and logical, while the other way around would give you

client/
   stackoverflow/
      com/
server/
   stackoverflow/
      com/

which is impratical.

无畏 2024-09-24 20:44:07

它是一种使用全局唯一名称作为所有命名空间的前缀的方法,从而使所有命名空间对全局唯一名称保持私有。

Its a way of using a globally unique name as the prefix to all your namespaces and thus keep all your namespaces private to the globally unique name.

﹂绝世的画 2024-09-24 20:44:07

实际上,符号通常从信息的最高有效位开始,以使信息的排序和分组更容易。 TLD 是域结构的根,因此也是最重要的信息位。因此以这种方式构建包是有意义的。当然,它是 com.example.mypackage 还是 example.com.mypackage 并不重要。但SUN决定选择更科学的方式。

关于日期格式,请注意有一个 ISO 将“交换格式”描述为: YYYY-MM-DD
这是相同的方案,因为年份是最重要的部分,其次是月份和日期。

因此,从这一点来看,使用“错误”符号的是 DNS 系统本身。但我认为他们试图优化整个 url 解析(例如“www”首先,以指示 Web 服务器)

In sience, notation is normally started with the most significant bit of information, to make ordering and grouping of the information easier. The TLD is the root of the domain structure and thus the most significant bit of information. So it makes sense to structure the packages this way. Sure, it doesn't matter if it's com.example.mypackage or example.com.mypackage. But SUN decided to prefer the more sientific way.

Regarding the date format, be aware that there is an ISO describing an "interchange format" as: YYYY-MM-DD
It's the same scheme, because the year is the most significant part, followed by the Month and Date.

So, when looking from this point, the one who is using the "wrong" notation is the DNS system itself. But I think they tried to optimize the whole thing for parsing of an url (e.g. The "www" first, to indicate a WebServer)

泪痕残 2024-09-24 20:44:07

这有点主观。您可能已经习惯了诸如“stackoverflow.com”之类的约定,并且想知道这些“com.apple”内容到底是关于什么的。或者您可以是一名拥有多年经验的程序员,像 "System.out" 这样的东西对您来说可能是最自然的事情。

com.apple 就像是在说“查看 com 域,在其中查找 apple”。

apple.com 就像说“寻找 apple,它可以在 com 域中找到”。

所以这完全取决于您使用的环境/情况。只是我的两分钱!

It's a bit subjective. You can be used to conventions like "stackoverflow.com", and wonder what the heck all this "com.apple" stuff is about. Or you can be a programmer with years of experience and stuff like "System.out" could be the most natural thing for you.

com.apple is like saying "look into the com domain, inside this, look for apple".

apple.com is like saying "look for apple, which can be found in the com domain".

So it all depends on the environment/situation you're using. Just my two cents!

極樂鬼 2024-09-24 20:44:07

不,这不是迂腐,而是创建一个命名空间。

可能还有其他 3 方开发人员/程序/等。也可以创建一个 iTunesHelper.plist
或 SQLRunner.java 类。您可以使用自己的名称空间作为前缀,例如您的域名
创建一个相当唯一的名称,以便 com.oracle.SQLRunner.java 不同并且不会与 org.postgresql.SQLRunner.java 冲突

No, it's not pedantry, it's to create a namespace.

There might be other 3 party developers/programs/etc. that also could create a iTunesHelper.plist
or a SQLRunner.java class. You prefix these with your own namespace, e.g. your domain name
to create a reasonably unique name so com.oracle.SQLRunner.java is different and doesn't clash with org.postgresql.SQLRunner.java

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文