Jeremy D. Miller has a great post on keeping source code where it belongs. The thought process behind this is that code should be where YOU would assume it would be. If its data access code, it should be in a project/namespace that is something like Data Access or DAL or Data or something that represents the lower layer of the architecture. If its the business rules/tasks the files should be in a project called Business Rules, or BLL, or Tasks, or something similar. It makes sense, just think about this — if you walk into a business and are given a project that was created by another developer and you’re getting a ADO.NET Exception, you’d expect to find the code Data Access code in a Data Access layer, NOT in the code behind. I should not have to hunt down where you put your data access code.
We’re talking about basic separation of concerns. The thing is, many developers lack these concepts because they’re under the assumption of “I can write this the correct way, and it will take me 2 weeks, or I can do it quickly and it will take me 2 days.” This may not matter when the application is running for a few months, but when you are asked to change the data provider from SQL Server to Oracle, or remove the web service calls and replace them with RPC calls, you’re going to find yourself in a world of hurt because you didn’t set everything up correctly. At this point they have amounted a large amount of Technical Debt.
He also noted that a large number of people were now using Ruby On Rails (RoR) as their development platform and I won’t deny that I also believe that Ruby/Rails is huge right now. Tons of shops are running RoR and even Martin Fowler said on Hansel Minutes that ThoughtWorks was doing about 40% (or more) of their business with Ruby. The key point Jeremy brought up is that “RoR forces web developers into a bit of a straight jacket, but that’s a good thing in a way.” I completely agree. RoR enforces a consistent source code tree layout which allows for developers to easily find there way around a project. “Developer A” can create a project with RoR and then “Developer B” can come along and take a look at it and be familiar with the code layout and structure. The RoR community has agreed that this is the basic way to organize a project and it seems to be working for them.
So what about .NET? Enter Tree Surgeon. Right now, its a stand alone application, but in its near future it should be implemented as a template in Visual Studio 2005/2008. So what is it? It’s a application that will create that straight jacket that Jeremy spoke of. It gives the developer a basic set up of layers, unit tests, code coverage and build script. It builds the entire source code directory and allows you to build on top of it. The source code layout follows a white paper written by Mike Roberts. I’ve been using it for quite awhile and I’m one of the developers on the project. I recently updated the source to allow creation of Visual Studio 2005 projects. Please note, this is only on the source and has not been reflected on the production release. Download the source, run it and then choose a application name, and generate the project source directory tree. Open the solution file and your application is ready to go.
The best part is that its easy to integrate existing projects into this format. I’ve done it quite a few times to allow for easy integration into my clients CI environment.
If you have any requests for Tree Surgeon, please visit the Issue Tracker page and submit and issue.
Enjoy!
Leave a Reply
You must be logged in to post a comment.