Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why are URLs in package names written in reverse?

 
joseph corner
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The title says it all
 
Naren Chivukula
Ranch Hand
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's just a convention. Its not mandatory. But, I'm glad to know more regarding this
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don�t know if this is the official answer, but it just makes sense from a directory standpoint, and as a �drilldown� methodology of taking a larger set, and refining it to a smaller subset. Using this naming convention, when a company or group has multiple packages, you cut down on the number of directories needed:
For example, given the packages:
com.foo.someApp
com.foo.someApp.helperClasses
com.foo.someApp.guiClasses
com.foo.anotherApp
you have


Here you have 6 total directories; if you went the other way:

This results in 14 directories and is a lot more confusing to find things. It is just a nature sorting order to go from the item with the largest quantity to the smallest. Personally, I�ve always felt that it is the URL�s that have it backwards
 
joseph corner
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Well, it's a fairly trivial question, and I know it's just a convention, but I'm interested in case there's more than meets the eye.
I don't see why with your example you couldn't have foo as the top directory, followed by com, followed by the various subdirectories.
Ie.,
foo.com.someApp
foo.com.someApp.helperClasses
foo.com.someApp.guiClasses
foo.com.anotherApp
It seems more readable to me. Have I missed something?
J
[ February 25, 2004: Message edited by: joseph corner ]
 
Ben Wood
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I always thought the most basic reason for assigning package names as reverse URL domains is that they become unique to the organisation or individual who uses that URL. That way you only have to worry about other people in your organisation writing packages with the same name because no-one else outside your colleagues should be using your URL to name their package.
Reversing it completely does seem the most systematic way of doing it to me as it creates a more pure hierarchy.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
joseph
You would have the root of the name in the middle:

This shall be the graph for your naming:
ibm.com.foo.c1;
sun.com.foo.c1;
or standard:
com.ibm.foo.c1;
com.sun.foo.c1;

There are domains like
foo.edu.uk
which lead to:
uk.edu.foo.c1;
but where would you search the net, if it was:
foo.edu.uk.c1;
You might search at the above mentioned place, for c1, or at
foo.edu
for uk.c1;
 
sever oon
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you think about it, URLs do, by convention, have the root web address backwards. Look at the URL above...saloon.javaranch.com/cgi-bin/ubb/...
So if you think about it, the pattern the URL follows is <site>/<directory>/<more specific directory>/...it's just that, by convention, the site components are listed in reverse.
sev
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic