在设计项目和布局体系结构时,我从两个方向开始。首先,我查看正在设计的项目,并确定需要解决的商务问题。我看看将要使用它的人,并从一个粗糙的UI设计开始。在这一点上,我将忽略数据,而只是查看用户的要求以及谁将使用它。
一旦我对他们的要求有了基本的了解,就可以确定他们将要操纵的核心数据是什么,并开始对该数据进行基本的数据库布局。然后,我开始提出问题来定义围绕数据的业务规则。
通过独立地从两端开始,我可以以将两端融合在一起的方式布置项目。在将它们融合在一起之前,我总是尽力使设计尽可能分开,但是在我前进的过程中请牢记每个设计的要求。
一旦对问题的各个方面有了充分的了解,我便开始规划将要解决该问题的项目的结构。
一旦创建了项目解决方案的基本布局,我就会查看项目的功能并设置一组基本的命名空间,这些命名空间将根据要完成的工作类型使用。可能是帐户,购物车,调查等。
这是我总是从头开始的基本解决方案布局。随着项目的定义得到更好的定义,我将其进行改进以满足每个项目的特定需求。有些区域可能会与其他区域合并,我可能会根据需要添加一些特殊区域。
解决方案名称
.ProjectNameDocuments
For large projects there are certain documents that need to be kept with
it. For this I actually create a separate project or folder within the
solution to hold them.
.ProjectNameUnitTest
Unit testing always depends on the project - sometimes it is just really
basic to catch edge cases and sometimes it is set up for full code
coverage. I have recently added graphical unit testing to the arsenal.
.ProjectNameInstaller
Some projects have specific installation requirements that need to be
handled at a project level.
.ProjectNameClassLibrary
If there is a need for web services, APIs, DLLs or such.
.ProjectNameScripts (**Added 2/29/2012**)
I am adding this because I just found a need for one in my current project.
This project holds the following types of scripts: SQL (Tables, procs,
views), SQL Data update scripts, VBScripts, etc.
.ProjectName
.DataRepository
Contains base data classes and database communication. Sometimes
also hold a directory that contains any SQL procs or other specific
code.
.DataClasses
Contains the base classes, structs, and enums that are used in the
project. These may be related to but not necessarily be connected
to the ones in the data repository.
.Services
Performs all CRUD actions with the Data, done in a way that the
repository can be changed out with no need to rewrite any higher
level code.
.Business
Performs any data calculations or business level data validation,
does most interaction with the Service layer.
.Helpers
I always create a code module that contains helper classes. These
may be extensions on system items, standard validation tools,
regular expressions or custom-built items.
.UserInterface
The user interface is built to display and manipulate the data.
UI Forms always get organized by functional unit namespace with
additional folders for shared forms and custom controls.