Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (527)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
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 687 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.

Thanks
Offline cylab

JGO Ninja


Medals: 55



« 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!
Online Jimmt
« League of Dukes »

JGO Kernel


Medals: 139
Projects: 4
Exp: 3 years



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

It's often your home/company webpage - in reverse, for example "org.java-gaming" - there are several sites to make free websites, for example www.devhub.com

http://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html
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
com
. Then I add the project name such as my GEJ in lower caps. It becomes
com.gej
. Then I'll start grouping the classes into multiple packages, like
com.gej.core
and all. I'll never keep a class in the root i.e.,
com.gej
. If there're anyone, I'll move them to the
core
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.
http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

PocketCrafter7 (12 views)
2014-11-28 16:25:35

PocketCrafter7 (7 views)
2014-11-28 16:25:09

PocketCrafter7 (8 views)
2014-11-28 16:24:29

toopeicgaming1999 (74 views)
2014-11-26 15:22:04

toopeicgaming1999 (64 views)
2014-11-26 15:20:36

toopeicgaming1999 (15 views)
2014-11-26 15:20:08

SHC (29 views)
2014-11-25 12:00:59

SHC (27 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (28 views)
2014-11-24 19:59:16
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org 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‑gaming.org
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!