How do you organize your code?
Back in July, Richard Lowe asked "How do you organize your code?" I'm asking it again because I'd really like to see what everyone has to say. When we first adopted .NET, it took us a long time to come up with a system for organizing our code that worked for everyone, and it wouldn't have taken nearly as long if we could have looked at what other .NET shops were doing. So, for anyone looking for a system to organize their code, here's what we do:
We have a number of common assemblies that contain our configuration, logging, debugging, performance, data access, time zone, and file formatting (CSV, XLS, SPSS, etc) classes. Each assembly contains one root namespace:
JTLeigh.Common.Configuration
and is contained in a file named after its root namespace:
JTLeigh.Common.Configuration.dll
and is organized under a directory named after its root namespace:
\Components\JTLeigh.Common.Configuration\
Each assembly directory contains source and releases directories:
\Components\JTLeigh.Common.Configuration\Source\
\Components\JTLeigh.Common.Configuration\Releases\
The source directory contains the source code for the assembly. We typically use it as our working directory when we're working on new versions of the assembly. We don't version the contents of the source directory outside of VSS.
The releases directory contains the binary releases of the assembly organized under directories named after versions:
\Components\JTLeigh.Common.Configuration\Releases\2.1.1\
Each version directory contains debug, release, documentation, and snippets directories:
\Components\JTLeigh.Common.Configuration\Releases\2.1.1\Debug\
\Components\JTLeigh.Common.Configuration\Releases\2.1.1\Release\
\Components\JTLeigh.Common.Configuration\Releases\2.1.1\Documentation\
\Components\JTLeigh.Common.Configuration\Releases\2.1.1\Snippets\
which contain the debug build of the assembly, the release build of the assembly, and any documentation and snippets related to the version, respectively.
We use the same directory structure for 3rd party components, application blocks, etc. We don't bother creating directories that will always be empty.
\Components\SoftArtisans.OfficeWriter.ExcelWriter\Releases\
(but no source directory because we don't have the source)
We organize products and tools the same way, only in products and tools folders:
\Products\JTLeigh.Products.Aichi\
\Tools\JTLeigh.Tools.CopySourceAsHtml\
We haven't found the distinction between components, products, and tools to be all that important, though, so if we were to do it all over again I probably wouldn't have separate component, product, and tool directories.
Whew!
Now how do you organize your code?
Colin
11:00 PM | Colin

TrackBacks
# .Net helper class for SQL Server Full Text Search04:23 AM | Michael Falconer
# Organizing VS.NET projects and Solutions12:07 PM | you've been HAACKED