PDA

View Full Version : Are Packages Worth the Effort?


Myth of Echelon
06-14-2011, 09:36 PM
I've seen many advanced examples of Flash and they all seem to use Packages. Obviously, there's some huge pro's to using Packages in Flash, but I just don't see them apart from the use and store of global variables?
What am I missing?

It just seems simpler to use AS3 inside of the project what with not having to create an external file, being able to view code and design in one pane and not having to assign classes.

drkstr
06-15-2011, 05:11 AM
Packages allow software engineers to feel warm and fuzzy when coding in an environment originally designed for hipsters...

If you have to ask if you need them, you probably don't. When your project starts getting large, then you will start wishing there was some way to organize all your code a bit better... enter packages. :)

The actual packaging structure is a matter of personal preference. For example, we package our library code based on dependencies (which is probably the most common method).

panel
06-23-2011, 09:19 PM
I 100% agree.
@Myth of Echelon just imagine having 500+ classes in one folder.

Myth of Echelon
06-23-2011, 09:48 PM
Packages allow software engineers to feel warm and fuzzy when coding in an environment originally designed for hipsters...

If you have to ask if you need them, you probably don't. When your project starts getting large, then you will start wishing there was some way to organize all your code a bit better... enter packages. :)

The actual packaging structure is a matter of personal preference. For example, we package our library code based on dependencies (which is probably the most common method).

I see. So are there any important advantages I should be aware of?
Because I don't even know how to assign a class to an object, and I don't particularly want to learn if I don't have to..

Barna Biro
06-23-2011, 10:03 PM
If you work alone on small projects, then obviously, no one will be forcing you to ever use packages. I for one, can't really imagine working without them... and it's not just because it makes me feel "warm and fuzzy".

The actual packaging structure is a matter of personal preference.
Mostly if you work alone... I doubt that working in a team environment, the manager will just let you create packages on the fly because "you feel like creating some". Although there might not be any "written rules", a standard that everyone can respect, but there are usually some guidelines on how to organize different types of classes... like: You won't see Container type display objects in the "utils" package.

Past a certain point, "is a matter of personal preference" will sound funny when you look around and see that other professionals seem to have "very, very similar personal preferences"... coincidence or not? ;)

and I don't particularly want to learn if I don't have to..
Not to be too harsh, but: That sounds extremely ignorant.
What exactly are you trying to achieve with this technology?

CyanBlue
06-23-2011, 10:09 PM
If your job "requires" you do AS and if you plan to survive another 5 more years doing it, you probably need to start learning it...

Think about the case where you are working on a-little-bit-larger-thank-your-day-to-day project where you need to work with your co-worker... It probably is not pleasant experience to dig around the Flash IDE to find all the required functionalities and whatnots that you need to fix that your co-worker worked on...

panel
06-23-2011, 10:14 PM
Another good point is that you are simple learning good habbits.
Sometimes small project becomes big and it just easier to do thing right from the beginning, beside learning about packages won't take you a lot of time ;)

wvxvw
06-24-2011, 06:54 PM
Another reason to use packages is, if I was that coworker who has to share the project with you, I simply don't have and cannot run Flash CS# - it doesn't run on my computer, so you would have to use them, otherwise you would continue to work alone :)

FEK315
06-25-2011, 03:45 PM
When I decided to learn AS3 I decided I was only going to do tutorials that had packages. As a beginner I think packages make everything much more elegant and simple to use, I'm not saying they are easy to learn but packages are what convinced me that AS3 was a language worth learning they seem to ad legitimacy to the language, that's my own opinion. Forcing myself to use packages has taught me A LOT about how flash works.
I love em and can't wait to fully understand em!:cool::):rolleyes::eek:

Oh I am such a geek! LOL!

Barna Biro
06-25-2011, 07:37 PM
Packages, in my opinion, are quite easy to understand and use. Just think about the following: haven't you ever created on one of your hard drives a folder called "games" where you'd install all your games? Or a folder called "kits" where you'd put all your software install kits? Or a "photos" folder that could also contain subfolders, such as: "vacation", "weekend", "cities", etc. ( those subfolders could be organized even more... like adding folders for years... so that you know from which year your vacation photos are and not just throw all possible vacation photos in there ).

Packages do the exact same thing... they help you organize your classes ( usually in a meaningful way... but not in a "meaningful only to the owner" way, but to even possible strangers or friends you might want to share your files with at a certain point in time ). Packages are also in essence just folders that contain classes instead of photos, games or software install kits. So, for example if you create a class that helps you work with Arrays ( which might have the following static methods: "removeItemAt()", "removeDuplicates()", "addItemOnce()" etc. ), then to keep things tidy and nice, you could place it into a package called "utils". If you'd create a class that would help you manipulate Strings, you could also place that next to your other class that manipulates Arrays ( since both are utility classes ). On the same example, you could create a LoginDialog component and place it in the "ui.dialogs" package ( normally, packages don't just look like: "ui.dialogs"... a good practice is to create a "base structure", like "com.ProjectName" and then start adding additional packages into this "larger container"; so "ui.dialogs", would normally / usually look something like: "com.ProjectName.ui.dialogs" - this is the full "dialogs" package name )... from that point on, whenever you are looking for a certain dialog, you'll know that it's most likely in the "dialogs" package, since that's where you ( or others should ) store dialogs.

Packages are really simple to understand... the hard part is actually trying to write nice components and classes which respect good OOP practices / principles.

FEK315
06-27-2011, 01:39 AM
I guess what I should say is I don't understand how getters and setters work.
I am not sure how and when to make a button talk or other object talk to the Document class or how much should be on the Document class or on the object class.
I am still just in the early stages of understand still.