Best way to organize the files in my project

别来无恙 提交于 2019-12-03 09:01:13

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.

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!