The Ultrashock Ultra Bundle
  • Home
  • Community
  • Forum
  • Flash
  • ActionScript
  • Thread
  •  
  • Previous topic
  • Next topic
Sign up to post

Flash
 ActionScript

  • Holaso Author 
    • 550 
    • 0 
    • 5 
    Significance of package names
    Holaso

    Last reply Mar 26 2008, 05:38 PM

    by Holaso

    Posted: Mar 20 2008, 05:11 PM

    by Holaso

     

What is the significance of the package naming convention?

What is the difference between “flash” and “fl”?

An example of “flash” is flash.display
An example of “fl” is fl.controls

  5 REPLIES
 
Nutrox
1  
Nutrox

Package names can be anything you want, but it is good practice to base the package names on a domain name structure especially if you intend to distribute any classes in those packages. In a nutshell it helps to avoid conflicts between two classes with the same name. Adobe are actually starting to do that now with their com.adobe.* package, I use com.neondust.*, and you might use com.holaso.* if you have the holaso domain name.

I think Macromedia/Adobe used the flash.* and fl.* package names because it makes things a lot easier when manually typing the package names in Flash, plus those classes are the core classes of the application. If I made a huge application called Fishy then I would probably just use the fishy.* package name instead of using com.neondust.fishy.*

Hope that makes some kind of sense. smilie

  • 20 March 2008 07:52 PM
  •  
Codemonkey
2  
Codemonkey

There’s no difference between flash and fl, other than readability. Don’t forget you might not be the only one getting to see the code. Maybe you’ll open source your stuff one day… maybe you decide to attract a friend on the project. You never know and even for your future self that looks back at the code would probably benefit from logical sounding package names (just the same as with class names and property names).

Like Nutrox said, there’s a convention that you would use your domain reversed; it makes sure your class name (formally, package plus class’ name) is unique all over the world. It also makes sure all your applications are structured the same way and can be put together without problem. If for example you put them all together, you would have all your applications located at d:\mystuff\flash\projects\org\houseofcode\*. Suppose you would start to use version control (svn, cvs, clearcase what have you) you can put all your projects in there in a consistent way, without having to worry about variable classpaths and stuff. Consistency is the key to enlightenment.

Aside from conventions, it is wise to use logical names for packages. In the java world for examples, there are some widely accepted package names that appear in almost every web applications.
For example:
org.housofcode.webbap.service
org.housofcode.webbap.dao (interfaces for data retrieval)
org.housofcode.webbap.dao.impl (if there are a lot of dao implementations, otherwise dump ‘em with the interfaces)
org.housofcode.webbap.application (model for example)
org.housofcode.webbap.controller
org.housofcode.webbap.database
org.housofcode.webbap.domain
org.housofcode.webbap.util
org.housofcode.webbap.value (value objects to expose domain objects to the views)
etc.

So, for larger applications it is not only a matter of readability, but also a matter of manageability.

Another thing, for advanced developers, packages can be very important in regards to exposing classes and interfaces to the public. For example, you can make classes package protected so that users outside that package cannot use that class. An example is that you do have a public interface, but keep the implementations hidden from the users by making those package protected.

Then there is the matter of teamworking on package units and determining the size of packages in general. I’ve written a post earlier about an article I found on this topic, which I thought was very interesting:
http://www.ultrashock.com/forums/oop/packages-and-granularity-83478.html

  • 21 March 2008 12:07 PM
  •  
Holaso Author 
3  
Holaso

Mostly I was wondering what Adobe-Macromedia had in mind with respect to functionality when they use “flash” vs. “fl”  For example is “flash” more display oriented classes while “fl” is more control related classes?  Is it simply an artifact of previous versions? Why were classes written in two different package sets?

  • 25 March 2008 04:25 PM
  •  
Nutrox
4  
Nutrox

I have to take a wild guess here, but I imagine that has to do with distribution. For example, the “fl” package is geared towards Flash CS3 because of the timeline/keyframe related classes, that package isn’t available in Flex Builder by default but if you have Flash CS3 installed then you can point Flex Builder at those classes. The “flash” package contains generic classes such as Sprite that can be used in both Flash CS3 and Flex Builder. Also, you will notice specific packages that are only available if you are creating a SWF file for AIR ( “flash.desktop” and “flash.filesystem” for example ).

  • 25 March 2008 08:03 PM
  •  
Holaso Author 
5  
Holaso

ah THAT answers my question thanks!

  • 26 March 2008 05:38 PM
  •  
  •   Log in or join for free to make a comment.
 
Topic actions
  •  Share on Facebook
  •  Share on Twitter
Topic Categories
  •  Show All Topics
  •  Development
    •  Server Side
    •  Client Side
  •  Creative Software
    •  Web
    •  Video
    •  3D
    •  Illustrator
    •  Photoshop Battles
    •  Photoshop
  •  Design
    •  Typography
    •  Resources & Insight
    •  Checkpoint
  •  Career
    •  Copyright Matters
    •  Advice & issues
    •  Job Seekers
    •  Job Offers
  •  Flash
    •  UltraMath
    •  OOP
    •  Third Party Tools
    •  Open Source alternatives
    •  Data Communication
    •  Components
    •  Flex
    •  AIR
    •  Flash Lite
    •  Flash Professional
    •  Flash Newbie
    •  ActionScript
    •  XML
  •  Lounge
    •  Polls
    •  Random Chat
    •  Showcase And Critique
    •  BombShock Award Nominations
  •  Community Essentials
    •  BombShock Award Winners
    •  Tutorials
    •  Interviews
    •  News
    •  Bitmap tutorials
Popular Topics
  • Sort by: 
  • Activity
  • Views
  • Comments
  • Likes
Advertise with us
  • Your advertisement here!
  • loading
Ultrashock
  • Creative Assets
  • Community
  • Blog
  1. Home
  2. Forum
+/-
Creative Assets
  • Categories
  • Contributors
  • How to buy
Make Money
  • Commission Rates
  • Referral Program
  • Contributor Program
Community
  • Activity Feed
  • Forum
  • Profiles
About
  • Quick Tour
  • Our History
  • Banners & Logos
Support
  • Contact Ultrashock
  • Advertise with us
  • Legal Information
  •  Keep up to date
  • Flash 775  Flash
  • Audio 6,481  Audio
  • Vector 2,130  Vectors
  • Image 12,338  Images
  • Creative Assets 21,724  Assets
  • Profiles 282,659  Members
  • Topics 93,762  Topics
  • Blog 4  Blog
  • Facebook 1,680  Facebook
  • Twitter 1,165  Twitter
  • Join our FREE monthly newsletter!
  • Archive
  • Invalid email address. Please try again.
Subscribe
  • ©2012 Ultrashock LLC - All rights reserved
  • Terms of Use
  • Privacy Policy
  • Switch to dark theme
  • RSS Feeds
  • Top

©2012 Ultrashock LLC - All rights reserved

Printed on Sat, February 04, 2012 - 19:27:11