SubSonic uses a few audit fields by default - you don't need to write any code. However, the field names that are used are coded into the source code. You can modify the source code and generate a new assembly, but if you're like me and would rather not edit the source code (so you don't need to update the code at every release), then you'll be looking for an alternative approach.
Oh noes! Microsoft .NET goes open source!
Well, not exactly. There's a lot of buzz going around the web today that started with an post by Scott Guthrie "Releasing the Source Code for the .NET Framework Libraries" (via DotNetKicks.com).
We'll begin by offering the source code (with source file comments included) for the .NET Base Class Libraries (System, System.IO, System.Collections, System.Configuration, System.Threading, System.Net, System.Security, System.Runtime, System.Text, etc), ASP.NET (System.Web), Windows Forms (System.Windows.Forms), ADO.NET (System.Data), XML (System.Xml), and WPF (System.Windows). We'll then be adding more libraries in the months ahead (including WCF, Workflow, and LINQ). The source code will be released under the Microsoft Reference License (MS-RL).
This generated a lot of buzz including:
- Charlie Calvert (Microsoft C# Community Leader)
- Shawn Burke
- Mary Jo Foley (ZDNet)
- Read/WriteWeb (although they seem to not completely understand what it means)
- AjaxNinja (nice summary of buzz coverage)
- Robert Scobleizer claims it's a little too late
- and dozens and dozens more blogs
What does this really mean for .NET Developers? Well, at first glance I'm agreeing with Aaron's (AjaxNinja) thoughts. It won't mean much to the average developer. And as I commented at over at DNK, the above average developer already uses Reflector to peek inside the .NET library.
I truly think this is much more of a PR initiative than a technical initiative. It's the "cool thing to do" and will (did) generate a lot of buzz and talking. I'm sure there will be blogs and articles abound in the next few weeks or months talking about this. Maybe in a few weeks, there will be some new information that might provide some insight into how this will be helpful to developers.
Update: JudahGabriel (via DNK) pointed out three reasons why this will benefit developer beyond what we already get from using Reflector:
First, the source comments are intact, which means it becomes easier to understand .NET library source code.
Second, the code structure and local variable names are preserved.
Third, we can use the debugger to step in to .NET libraries and use the threads, locals, watch, etc. windows.
Shawn Burke also provides a good reason why this might benefit the average developer saying:
Even with one of the decompilers (e.g. Reflector) that you can easily get out there, [an exception from deep in the code] can be tricky to solve. With the source it's much, much easier.
On my path of becoming a better developer, I've began participating in the development of DotNetKicks. DotNetKicks is an open-source project that is a community driven link submission portal. In other words, it is very similar to major web sites of Digg and Reddit, but its focused into specific areas of technology.
DotNetKicks.com is a community based news site edited by our members. It specializes in Microsoft development techniques, technologies and tools including ASP.NET, C#, VB.NET, C++, Visual Studio, Team System, SQL Server and Microsoft Vista.
Like most open source projects, the project uses Subversion. I've used SVN a few times before for other open source projects. In the past, I've just used the SVN command line. But this time, I downloaded and installed TortoiseSVN and it has worked great so far.
I've been able to address a couple enhancement requests including adding a way to see which stories a user has submitted (DNK issue 24) and see all of the comments submitted by the user (DNK issue 62). These were two pretty simple fixes that were resolved by adding some stored procedures and a little bit of coding. Gavin Joyce, project lead, writes about the new features recently added to DotNetKicks on his blog.
One of the things I've notice from reviewing the code so far, is the use of a data abstraction and business layers. In most of my work so far, I've seen very little implementations of these layers. Most of the projects that I've written or reviewed had the presentation, data, and business layers combined into the web page (either ASP.NET or JSP).
There are advantages and disadvantages to using data abstraction layers and nearly everyone does it or reads about it for academic reasons. The largest benefit is transporting the database to another vendor or platform. You can just edit the DAL instead of going through each page and updating your SQL code for any RDBMS vendor specific code.
But that doesn't happen very often for most internal company web sites. For the most part, I've worked on Oracle databases for the government and SQL Server databases for commercial and in-house projects. I've never been apart of something that need abstraction for portability.
One of the advantages that I found is the use of strongly typing the data. When directly querying a database and just outputting the contents, its impossible to test for the existence of columns at design time. With an automated build process that generates the DAL, you can find errors when referencing database objects that may not exist or be of a different data type that you code in your presentation layer.
The DNK project uses SubSonic to automatically generate a data abstraction layer for its SQL Server 2005 database. SubSonic is an open-source project that can generate data abstraction layers for SQL Server 2000, SQL Server 2005, MySQL, and Oracle databases.
An alternative to SubSonic is to use Strongly Typed TableAdapters. Scott Gu provides a detailed tutorial on how to build a data abstraction layer using Visual Studio.