Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class naming convention




On Aug 30, 2006, at 3:02 PM, bsd5tu1 wrote:


I've always disliked using packages when possible

One thing you might want to keep in mind if you don't use packages at all would be...


import Thing;

public class TestClass {

}

class Thing {
}

gets this when you try to compile...

javac TestClass.java
TestClass.java:1: '.' expected
import Thing;

They stricted up package usage at some point. I'm not recalling exactly where, you used to be able to import unpackaged classes but can't anymore.
I thought there were times this meant the class was almost inaccessible. But testing at the moment seems to indicate that you can still reference the class fine with ...


		Thing.main(new String[0]);
		new Thing().main(new String[0]);

things like this.
Huh, I remember I started packaging a lot of my own unpackaged because of this. But maybe it doesn't matter that much and if you find unpackaged works for you there is no reason, other than following recommended but not enforced guidelines, to package.
I tended to use unpackaged for command line tools classes. One word lower case names seemed more Unix like than packaged java names.
e.g.
javac
seems more normal as a command than
com.sun.tools.javac.Main



Mike Hall mikehall at spacestar dot net http://www.spacestar.net/users/mikehall http://sourceforge.net/projects/macnative



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >Class naming convention (From: bsd5tu1 <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.