We were taught to avoid conflicts by using a package name such as com.adigio.subproject.package
. This is much better than just using a project name such as “web.” for sure.
However, I keep running into packages such as com.mything.*
where mything isn’t a domain at all that the owner owns.
So now, we have moved the namespace clash down a notch.
Do we need the com
package anymore? Would adigio.*
really be so much worse?
A large part of me thinks not, and as long as we are not stupid and do not pick generic top level packages, we would be fine. This seems to work OK in the other language camps :)
In fact, in some ways, I always liked the fact that: Net::FTP and Net::HTTP could actually be written by different parties…. and that is managed in a different way.
Do you like the com
package? (or .net, or .countrycode, etc).
Think about how much package renaming we wouldn’t have to go through in open source (net.sf.* -> org.myproject.*). For example, if Hibernate was just hibernate.*
to begin with.
May 25th, 2005 at 5:12 pm
We had this discussion for Wicket, and in the end decided to go for wicket.* instead of net.wicket.*, org.wicket.* etc.
I usually stick with the com.* (or actually nl.* as I make dutch programs mostly) schema, but having used wicket.* for some time, I like the fact that it is short.
May 25th, 2005 at 5:20 pm
Eelco -
Interesting that you made that choice. How are you going to handle the million other wicket.* classes out there though!!! ;)
D
May 25th, 2005 at 5:35 pm
Uh no, why didn’t we think of that! Glad we haven’t put out 1.0 final yet!
May 25th, 2005 at 6:03 pm
I keep my proprietary code in the com.domain[...] packages and my open source code in the org.domain[...] packages.
May 25th, 2005 at 8:59 pm
If people write code for com.mything and they don’t own the domain mything.com, they are violating the spec. Domains are cheap. Why should we change the rule because some people violate the spec? If we get rid of the first level and I own mything.com and someone else owns mything.net, do I have to coordinate my classes with them to make sure we don’t duplicate?
If I download code and it violates the spec of reverse domain names, it either gets deleted or I refactor it. The bigger the package, the more time it takes to refactor, so it better provide a lot of bang for the buck, or it gets deleted.
By the way, your comment box is the most annoying comment box anywhere. The cursor doesn’t appear where the text is being typed.
May 26th, 2005 at 1:25 am
That sounds pretty drastic. Do you refactor because you expect actual conflicts, or because you want to make this world a better place?
And did you really refactor/delete JUnit, Ognl, Concurrent and Antlr to name of few?
May 26th, 2005 at 6:09 am
Interestingly enough, Hibernate v1 was in the “cirrus.hibernate” package, I suspect because au.com.cirrustech.hibernate was just way too long already.
There are also a bunch of Confluence classes in bucket.*, after the paved-with-good-intentions idea that if we put all our common code in there, it’d force us to come up with a good name for the package before we released it. :)
May 26th, 2005 at 10:16 am
The conventions will only work if we uphold them.
When you get into a name confilct with a vendor of yours then you’ll end up renaming packages anyway so there is no gain there.
That is, if not having your IDE refactor package names for you is a gain in the first place.
For that matter, i think separating words in class names with _ is nicer, lets try that. Plus no indentation for me. And I also like my comments all at the end of each method.
May 27th, 2005 at 3:50 am
There is a difference though between accepted standards that leave nothing left for interpretation (like using camel case and starting your methods with javadoc comments) and those that do, like using a domain name. It could be the case that no domain is available. Or you’re not sure whether you will be on the same domain the next year for a starting project. And whether a domain is cheap or not naturally is a relative statement. It might be for you, but not for someone this lives in India or China for example.
May 31st, 2005 at 10:54 am
I stopped preceding package names a few years ago and have yet to run into a problem. Having the package name relate to a domain is silly and serves no practical purpose. If your company is called “Some Java Shop” then I would simply have somejavashop.com but use the namespace sjs.*. Preceding with com/net/org also unnecessarily lengthens the namespace forcing you to scroll sooner in your IDE’s package navigator.
April 8th, 2007 at 2:06 am
louisiana home equity loan
April 8th, 2007 at 2:07 am
http://health86.narod.ru/index.html health insurance
health insurance
[url=http://health86.narod.ru]health insurance [/url]
September 5th, 2007 at 6:47 am
Barkas52147 Beliy Us
September 5th, 2007 at 6:50 am
Barkas52147 Beliy Us