views:

524

answers:

3

What is the best way to organize the files in your project?

For example do you put all user controls in a separate folder or do you place them in a sub folder? Do you have business logic folder? A helper classes folder?

I used to organize my projects like this:

Project/User Controls/Module Name/ Project/Classes/Module Name/

Now I am learning more towards something like this: Project/Module Name/User Controls/ Project/Module Name/Classes/

What is the best way? Especially if the project gets really big? What type of folder structure should exist?

+2  A: 

First the purpose of folder separation is to be an extra level of documentation, to let the programmers find code easier. That means you should not have extra levels "just to organize stuff". That excludes folders named Classes, Controls, etc.

Some examples:

If you work on a thee tier App it would make a lot of sense to have something like:

Project\Tier (Model|Controller|etc)\Classname

If you program is big to the point of having separate functional areas I would go with:

Project\Functional Area\Tier (Model|Controller|etc)\Classname

That is particularly usefull when sub-teams work on the different functional areas.

Also refrain from very deep folder trees (IMHO, more than depth 4 is too much) and keep your folder names compact. Some tools might have limitations on path size as low as 255 chars, so this is one place where brevity has its place.

David Reis
A: 

I separate our major chunks into projects - makes it very easy to reuse.

Within a project I do folders (and names) by functional areas.

That's as far as I go on a generic basis - the needs of the project determine any further partitioning.

Raj More
same here. I put related classe in projects together, then further split them up using folders.
Colin
A: 

I agree with the other answers that suggest naming folders by purpose and not type (i.e. call a folder Model, not Classes and include only data-oriented classes in that folder). Additionally I like to keep all Controls and Data/Model related classes in their own separate projects that are not allowed to reference each other. This can help you enforce the separation between view and model in your code which is generally a good thing.

James Cadd