• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Package Names and Web Apps

 
Jack Gold
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that HFSJ names packages:

com.example.model
com.example.web

Is this based on a website name paradigm. So for instance, if my website were called xyz.com, my packages would be called com.xyz.model, com.xyz.web ?

Do the packages in a webapp always begin with com, org, it, etc. . . ?

Just looking for guidelines to use for package names when developing my own applications.

Thanks
 
Chintan Rajyaguru
Ranch Hand
Posts: 341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look herefor Java coding conventions.

To answer your question while package names do not have to begin with com, org etc. they typically do. Convention many companies follow is
com.companyname.businessunitname.projectname.modulename.whatever
You may add or take out stuff from above as needed. If I were writing a test programs, I would simplay create a package named 'test' (without quotes) and it would be perfactly valid.

Download any jar file such as junit, struts, commons logging, log4j and open it with winzip you will see package structure under path column. That should give you a pretty good idea.

If you are writing your own personal application, feel free to give whatever package name you want (make them all lower case by convention though). If I were you, I would put my name in it so if some one decides to download or distribute my code, my name also goes out there

Edit: Forgot to add that if I were HFSJ, I would put com.oreilly.hfsj.chapterx.example or something similar
[ August 25, 2005: Message edited by: Chintan Rajyaguru ]
 
Jack Gold
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic