Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (761)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (845)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Package naming conventions  (Read 2294 times)
0 Members and 1 Guest are viewing this topic.
Offline 8Bit_Jedi

Senior Newbie

« Posted 2013-04-30 11:55:58 »

Hi Everyone,

When I did work on android based Apps, it was very important that your package names were unique
so I proceeded to use the normal naming conventions org.something.main etc.

I was wondering is this true for Java games that get deployed to be used on the desktop, should your Classes be put in uniquely identified packages? (com.gameengine.utils)

As a side note: What would you use if you don't have a website or even a game title to use yet, in creating package names.

Offline cylab

JGO Kernel

Medals: 182

« Reply #1 - Posted 2013-04-30 12:40:57 »

just use your name or nickname as toplevel package. then use subpackages to group things you want to group like you are usually using folders. you may also put the projects (code-)name in the middle,if you want... as long as you don't want to release your code as library, dont bother too much about packages. just dont put any classes or stuff in the default package (toplevel without folders), and you'll be fine. even this advice is actually just common convention and might only be relevant if you use classpath scanners or get deployed in a shared environment with classloader hierarchies...

Mathias - I Know What [you] Did Last Summer!
Offline Jimmt
« League of Dukes »

JGO Kernel

Medals: 167
Projects: 5
Exp: 6 years

« Reply #2 - Posted 2013-04-30 16:27:58 »

It's often your home/company webpage - in reverse, for example "" - there are several sites to make free websites, for example
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #3 - Posted 2013-04-30 20:28:26 »

its only important if you write a 3rd party API to be used by others or develop on android

other than that I never do it, its kinda silly

Offline davidc

Senior Devvie

Medals: 5
Projects: 2

« Reply #4 - Posted 2013-05-01 02:12:02 »

I've got my own domain name so that part isn't an issue, but I'm still not sure what path to take with prototypes. Typically I'll just give it a name that vaguely describes what I think the game will be, but often the nature of (or story behind) the game changes so much that the name no longer fits. I then need to do some refactoring to change the package name. It's not a big deal, but has the potential to play havoc with your version control, in particular comparing older versions of files when their folder has changed.

Does anybody use code names for their packages when in the prototype phase? Or even sequential names, eg. game102?
Offline SHC
« Reply #5 - Posted 2013-05-01 09:56:20 »

I first use
. Then I add the project name such as my GEJ in lower caps. It becomes
. Then I'll start grouping the classes into multiple packages, like
and all. I'll never keep a class in the root i.e.,
. If there're anyone, I'll move them to the
sub package.

Offline 8Bit_Jedi

Senior Newbie

« Reply #6 - Posted 2013-05-02 08:24:10 »

Thanks you all, all of this is very helpful, I went with the com.[PROJECT_NAME].[MODULE],
this seems the best way to logically group everything.

In the Java docs they also talk about package-private which then fits in nicely, even though
I would never declare class and class members without a access specifier.
Pages: [1]
  ignore  |  Print  

EgonOlsen (350 views)
2018-06-10 19:43:48

EgonOlsen (343 views)
2018-06-10 19:43:44

EgonOlsen (291 views)
2018-06-10 19:43:20

DesertCoockie (515 views)
2018-05-13 18:23:11

nelsongames (808 views)
2018-04-24 18:15:36

nelsongames (793 views)
2018-04-24 18:14:32

ivj94 (1251 views)
2018-03-24 14:47:39

ivj94 (395 views)
2018-03-24 14:46:31

ivj94 (1058 views)
2018-03-24 14:43:53

Solater (413 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!