In this tutorial, you will learn how to name your libraries and their packages in an easy and readable way. Though most of these are unorthodox, it will make your packages readable and easier to maintain.

The word com really does mean computer or related to a word .com in the web.  It’s a concept of having a root name that is unique when compared to all other packages that exists in a specific directory.  In this case, the word com actually means the scope of your company. What’s missing typically is the company name. However, most classes nowadays can be used interchangeably either into a web or desktop application. So the point is, it’s OK to remove the scope if the purpose of your library is generic. In short, you can have a template for the three structures: companyname.scope.packagename.





Another feature of ActionScript 3’s is it’s ability to distinguish capital letters in package names.  You can actually name them with inter-caps, combined with a plural convention like Com.PackageNames1.PackageNames2.

For instance, I typically name most of my generic personal library packages as:






So if you have multiple classes, you can just name them under the package as:




With this, conflicts can be avoided when having the same class names.  For example, both Senocular and I have a class called in each of our own libraries.  If I decide to use either of these classes, on a single .as document, I can just say so using a fully qualified class name like so:

var myTool:Prezire.Graphics.TransformTools.TransformTool = new Prezire.Graphics.TransformTools.TransformTool();
var hisTool:Senocular.TransformTool = new Senocular.TransformTool();

Compare your code being like this. The conventional style wherein there is a word com in the first, mixed plural and / or singular package names and all lower cased letters.  The first one is using a singular hiddenobjectgame folder name all in lower case…

import com.mobiles.hiddenobjectgame.HiddenObjectGameIntro;

…to an unorthodox like this, which maintains the plural form of a folder name HiddenObjectGames using inter-caps.

import Prezire.Mobiles.HiddenObjectGames.HiddenObjectGameIntro;

So there you have it. A cleaner and easier to maintain package!