1

I'm trying to get in the practice of using packages for my HW assignments and my personal projects. As a student of a university would it be proper for me to use edu.university_name.my_name.package_name?

As for personal projects it seems a lot of people are recommending that one should use their GitHub domain. If I one day plan on using my personal code in an application would using my GitHub domain be a proper way to name a package?

Just looking for a little advice

steveclark
  • 537
  • 9
  • 27
  • Possible duplicate: http://stackoverflow.com/questions/292169/what-package-naming-convention-do-you-use-for-personal-hobby-projects-in-java – Sandeep Chatterjee Mar 14 '15 at 20:14

3 Answers3

0

Your naming convention edu.university_name.my_name.package_name looks fine.

For other purposes I recommend you to use the domain you would like to use one day, e.g. org.steveclark.package.

Crazyjavahacking
  • 9,343
  • 2
  • 31
  • 40
0

An Internet domain (like a GitHub domain) is unique. A family name is generally not unique . So I would recommend you to use a name that you know is unique across Internet.

0

The idea of naming your packages is would you ever want to use your packages with third party packages yours should be unique to prevent duplicate classnames in the project. Also unique package name is required would you ever upload an apk to google play store.

For college I think you are safe enough using the suggested package-name as long as you use both name and surname. For personal projects you could use your github uri, which by default is unique, but you could also consider buying a domainname and use that one.

avk
  • 871
  • 1
  • 9
  • 22
  • Okay, I guess my biggest concern is that the graders will be running my code along with all of the other students code on their machine and I didn't know if an error would arise if another student and I used the same class name. – steveclark Mar 14 '15 at 20:31
  • As long as the package name is unique you do not have to worry about that. – avk Mar 14 '15 at 20:51