Next: , Previous: , Up: Top   [Contents][Index]


5 Packages in J.T.W. and Java

The structure of a package mirrors the file system. For example you can have a package named (for argument’s sake) pkg which corresponds to a folder pkg in your ~/jtw-tutorials folder. You can have a sub-package called (for argument’s sake) inner which will reside in the folder ~/jtw-tutorials/pkg/inner. Even though the second package resides inside of the first package, they are still considered as separate packages.

There is a naming convention that I will not bother to use that helps to give unique names to your packages. If you own a website like davinpearson.com you can name your packages like so: com/davinpearson/inner/inner2 where com/davinpearson where com.davinpearson.inner and com.davinpearson.inner.inner2 are separate packages. The fact that I own the domain name davinpearson.com ensures that my package specification com/davinpearson is unique. The com comes first because it is the actual domain name rather than the com extension that is unique. It is therefore non-sensible to place any code directly in the com folder. So in effect we are piggy-backing onto an existing standard i.e. Internet Domain Names. The same feature is exploited by Websites which ask for your email address as your login, as email addresses are unique to individual people.


Next: , Previous: , Up: Top   [Contents][Index]