`

Wednesday, September 15, 2010

Why Do Package Names Start With com. In Actionscript 3?

Question:

Why do package names start with com. in Actionscript 3?

By the way, I’m guessing you already know that package names map to folder names. E.g. an as3 source file in the package com.example must be under the folder example, which in turn must be under the folder com..

Answer:

Package names do not have to begin with com. However, it is the convention to do so. E.g. com.lynda.item

What is the significance of com? Well, the package name is simply a domain name reversed. E.g com.lynda.utils

The domain name technically does not have to exist but you should own it. Obviously never use someone else’s domain name!! That’s just rude. It is standard practice to use a domain name because it helps to guarantee that your package names don’t collide with the names of someone else’s package on the other side of the world.

If I release some AS3 code that creates popup windows, I may place the code in a package called com.lynda.utils.popupwindow and not simply popupwindow

Likewise, if I download some third party code to use in my own project I’d expect their code to be packaged properly. E.g. com.google.utils.modalwindow. Then, I can just place their google folder under by own com folder.

Just as importantly, putting your as3 files into packages helps you think about how to organize the files. Often people place all files (their own and 3rd party code) under one folder! The advice is - don’t.

1 comment:

Brian Williams said...

With a view to make any alterations within the matter, one wants utilizing PDF to Phrase changing device, because the latter is one the place any type of enhancing may be executed. Conversion might be made into or from numerous codecs resembling Excel, Doc, Phrase, RTF and plenty of extra. If you want to learn more about this topic please visit onlineconvertfree.com