PureMVC Architects Lounge

Announcements and General Discussion => General Discussion => Topic started by: ghess on February 06, 2008, 11:23:30

Title: Project Directory structure
Post by: ghess on February 06, 2008, 11:23:30
Hi All,

Getting ready to start my first project and am looking for guidance on the project directory structure.

Should the main source folder just be the root project dir?

Should this main source folder contain an assets, css, com, org ect.. or should I separate swf, css and image resources from the code?

From the training I like the package structure com.comp.app.model/view/controller.

Any examples are much appreciated.



Title: Re: Project Directory structure
Post by: Rhysyngsun on February 07, 2008, 12:56:35
I have been placing my assets withing the subdirectory of whatever components/code uses them. This has two benefits: cleaner code and if I ever decide to reuse the code, I only have one directory to copy. Although I would say that for a style for the entire application, you may wish to place this at the root instead of having it scattered about. It depends a lot on the relationship between your skins and your code.

If you have an application that is split up into multiple parts then I usually split it up into sub folders (i.e. com.puremvc.app.forum.view, etc. ). This way packages contain only code relevant to that particular piece of functionality.

A little digression; the package structure isn't usually named after the company/organization but rather the reverse domain name of your website:

Ex..: www.puremvc.org -> org.puremvc.....

The reasoning behind this is that only one individual/organization is associated with a domain name, this helps avoid package naming conflicts.

Of course, this mostly matters if you plan on reusing your code elsewhere/distributing it or are bringing in libraries that having naming conflicts with yours.

Here's a document on Adobe's site explaining it in more detail (it's for AS2, but most of it carries over, package details are near the bottom):

Title: Re: Project Directory structure
Post by: ghess on February 07, 2008, 02:55:40
Thanks for your comments!

I didn't consider placing assets with the components, interesting strategy and see your point. Past projects I have worked on in java, I made great efforts to place style, layout and graphical assets away from the java classes and always avoided at all costs placing code in the jsp's. This was because I often had a graphics/web designer working on the same project and to avoid code corruption allowed them to work isolated from the actual logic. Graphics and web designers are familiar with xml markup, style sheets and graphics, but not the code and allowing them to perform their work without the confusion of negotiating with the code was very benefitial to both sides of the team. The project I am working on does have a graphics/web designer and for the reasons mentioned I may not employ this strategy. For these reasons I am also feeling a bit uncomfortable placing 'views' folders inside the source tree, however the close relationship with the mediators is convinsing me otherwise. However, being a new team, new employer new language/sdk I am not sure if the graphics/web designers will be comfortable editing view components directly. I am going to try and I guess will train them on only editing 'components' and assets folders. Have you had success with this in your projects?

My application is split up into multiple parts and will follow the strategy you referenced.

I also think it might be wise to create a separate main source in the project root folder 'src' to house the project source to avoid polution (metadata folders, build output, libs and htmltemplate).

Much appreciated!