I didn't see anyone address why you do your package directories like Charlie
suggested!

 

The reason is to make sure each piece of code is in a unique place with a
unique path. If you are the owner and manager of the domain Hubbard.com,
then no one else is likely to use that same path. For larger applications or
for reusing shared code, this can become important.

 

Now why is it that you use com.hubbard instead of Hubbard.com? Good
question, and I don't really know the answer. Worse, I may have just
embarrassed myself. Worse still, I'm a board member of AFFUG, and I may have
just embarrassed the board!

 

If I can embarrass myself this much in an email, maybe you should come to
our next meeting and see what might happen there! With all the embarrassment
I might create, it's got to be safe for someone who just wants to learn
Flex!

 

   Clarke

 

From: [email protected] [mailto:[email protected]] On Behalf Of Charlie Hubbard
Sent: Friday, October 23, 2009 4:09 PM
To: [email protected]
Subject: Re: [AFFUG Discuss] Organizing

 

Well com.mydomain is just for illustration.  It's a Java-ism to name your
packages after the domain of your website (com.adobe, com.ibm, etc).
However, Flex's package structure (mx.events, mx.containers, etc) doesn't
follow the website domain idea so it's not universal just common.  

 

And, yes I further subdivide my structures up along lines that make sense.
So I might have packages for events, util, skins, renderers, etc.  Say I had
a project called mp3player.  I might create packages like:

 

com.hubbard.mp3player

com.hubbber.mp3player.events

com.hubbber.mp3player.skins

com.hubbber.mp3player.util

com.hubbber.mp3player.playlists

 

The names of the packages are going to come from whatever I'm doing and
whatever makes sense for that project.  I can't prescribe you a design that
would work in every project.  Just vague rules or conventions.

 

mxml is tricky with packages, but you can put them under packages.  You just
have to deal with packaging and xml namespaces which can be a pain, but it
can be done.  Typically I leave my mxml in the root folder (aka src), then
all of my actionscript I put under my packages.

Charlie

 

On Fri, Oct 23, 2009 at 3:50 PM, Sarah Davidson <[email protected]> wrote:

Charlie, 

 

This is exactly one thing I'm looking for!

 

Design pattern not the same thing. noted. :) I had asked someone else for
help and they told me to look that up which didn't yield anything helpful -
just arguments. 

 

In the com.mydomain folder do you just dump all of the as and mxml in there?
You don't further sort/group them into folders of what they might be for or
anything? I've seen references to the com.mydomain folders, but I don't
remember any of them saying why it's named that way so I wasn't sure about
it.  

 

Thank you again!! Now to figure out my second problem.

 

Sarah

 

On Fri, Oct 23, 2009 at 2:51 PM, Charlie Hubbard <[email protected]>
wrote:

Ok here's roughly how I setup my folder structure for a project (again, for
future reference, folder structure is not a design pattern).  As noted in
other replies this isn't a standard, and lots of people will have other
opinions about the perfect layout.  There are some rules you have to follow
(like actionscript packages have to be nested folders), but other than that
it's what works for your project. This is from the perspective of a Flex
project.  Doing AIR projects there are other things to consider (database,
support files, etc).

 

project_root

   bin-debug       [1]

   bin-release     [2]

   html-template [3] 

   src                [4]

      com

         mydomain

            Class1.as

            Class2.as

            ...

            ClassN.as

      assets     [5]

         images

         css

         fonts

   lib             [6]

   tests         [7]

   doc           [8]

   build.xml   [9]

 

[1] compiler debug output from FlexBuilder goes here.  FlexBuilder creates
this for you so not to worry.

[2] compiler release output from FlexBuilder goes here.  FlexBuilder creates
this for you so not to worry.

[3] HTML template used for running in FlexBuilder and possibly your site.
FlexBuilder creates this for you so not to worry.

[4] action script and mxml go here.  Typically you'll put your actionscript
in some package like com.mydomain

[5]  assets folder holds my css, icons, and any fonts (if I have those)

[6] Any dependant SWCs I keep in lib.  FlexBuilder usually adds this to my
project for me.

[7] All unit test code goes here (again following the package structure
layout).

[8] Any project documentation, or AS doc I put there (optional)

[9] My build file I use with Ant to build my project from the command line,
and automated builds.

 

HTH

Charlie

 

On Thu, Oct 22, 2009 at 10:21 PM, Sarah Davidson <[email protected]> wrote:

Hi.... this is the first time I've tried this and I'm just beginning with
Flex. Please excuse what may seem like silly questions :)

 

For most things I have been trying to do, I have been able to find solutions
online or in my books, but the one thing that I can't find any good and
consistent information on is organizing everything. All the examples work
with just one file. So far there are two things that I'm trying to figure
out (since my project has lots of files):

*       A folder structure (design pattern?). I want to be tidy.
*       A place to put all my WebServices so I don't have to copy different
pieces to every single component. Is there a way to do some kind of include
that references a file that lists all my services?

Thank you!

 

 

 

 




-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------

Reply via email to