Project Structure

The beginning is always a good place to start so they say so before I start any coding I’m going to think about the application or project structure.

What does a project consist of?  Sure there’s the source code project(s) but is there anything else that is a fundamental part of a project? 

One of the things we’ve struck on at work is the ideal of providing a self-sufficient ‘package’ that potentially anyone else in the office could pick up in the event that we’re eaten by a tiger on the way to work one morning.  
In this context ‘self-sufficient’ means that it holds everything that would be needed to get a succesful compile.   So that means the source code and any dll’s the solution depends on.  
OK but is there anything else?   Well if the worst did happen and you’re lumbered with a project you’re unfamiliar with, some documentation might be useful.
If you’re developing using a test driven approach it would be handy if the tests were in the same solution too so if you need to make a code change you could easily check you hadn’t broken anything else.
A testing framework may provide tools if you’ve got the tests in the solution then you’re going to need the tools that allow them to run.

OK – I think that’s covered the fundamentals, what we need to do now is apply that to a folder structure to be used by the solution.
What we’re aiming for is something like this:

project structure

So you have the project root which is where you put your solution, a lib folder where you drop any of the dlls your solution depends on, the src folder which holds your project source code and a tools folder which contains any tools you might use when writing the app.

Taking it a step further now, let’s assume that you’re using a test driven approach.  The src folder is going to hold the application projects and the associated test projects so we can expand the project structure again to the following :

project structure

The app and test folders have been added under the src folder so there’s a distinct split between the project source and test code.
Obviously all of the above folders are optional.  What I’m trying to illustrate is that the project folder can contain everything you need to do with a project, not just the source code, and when it’s all checked in to whatever source control you use it should be self-sufficient.

The next blog post : Creating Projects will illustrate how to use the structure above.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s