Microsoft should ship SubSonic (formerly called ActionPack) with Atlas - Jon Galloway

Microsoft should ship SubSonic (formerly called ActionPack) with Atlas

Yesterday, Phil got me to watch the SubSonic screencast (it was actually called the ASP.NET ActionPack and was since renamed). I'd seen posts about it on my main RSS feeds and had ignored it because everyone had been giving their posts titles like "ActionPack - Ruby on Rails for ASP.NET." I've watched all the ROR screencasts and have been a little underwhelmed1, so I didn't bother reading further. Big mistake.

SubSonic is one of the coolest web development things I've seen in a while. The 20 minute screencast is well worth the time, but here's the basic idea:

  1. Add a reference to the SubSonic DLL
  2. Add a few lines to your web.config - tell the ActionPack how to connect to your database, and add a block that tells ASP.NET to use the SubSonic build provider.
  3. Build.
  4. (a miracle happens)
  5. Enjoy the magic.

What do I mean by magic? Again, I'll ask you to watch the screencast rather than read my boring description, but I'll give it a shot. The SubSonic build provider gives you a full featured data access layer without adding any code to your project (unless you want it). That takes care of the biggest problem with code-gen'd DAL's - the piles of generated code files which clutter up your project and need to be kept up to date although many of them may never be used. Second cool feature: a scaffold server control which gives you the same kind of basic admin functions that ROR scaffolding provides (and a few extras, like following foreign keys for dropdowns). For example, when pointed at the infamous Northwind database, here's what you get from the following server tag (no other code required):

<cc1:Scaffold ID="Scaffold1" runat="server" TableName="Products"></cc1:Scaffold>

Aside from auto-created collection classes, there's a nice dynamic query system:

Query qry = new Query(Product.Table);
qry.Top = "10";
qry.OrderBy = OrderBy.Desc(Product.Columns.UnitPrice);
GridView1.DataSource = qry.ExecuteReader();
GridView1.DataBind();

I particularly like the column and table name structs - I commented yesterday that it would be cool if he added them to eliminate the need for string parameters; less than two hours after I posted the comment he posted a new release with that feature. That allows you to code to something like Product.Columns.UnitPrice rather than "UnitPrice", so you get both autocomplete and compile time checking. Nice!

<crazy-talk>

Here's where Dr. Jeckell's "hey, check out this neat thing" post ends and Mr. Hyde takes over... Rather than letting this languish on the list of neat tools ASP.NET bloggers talk about, Microsoft should do something out of character - they should ship SubSonic with Atlas.

Why?

Well, first, the rationale: SubSonic is a great next step in the "less code is good" philosophy of ASP.NET 2.0. At a minimum, adding SubSonic to ASP.NET would be a great bridge until DLINQ comes out. It would be great to have ASP.NET span the range from ROR "it just works" simplicity to the high end systems we all know it can do.2 Even ASP.NET superstars are admiring ROR's simplicity, and ROR is quickly becomming synonomous with Web 2.0.

Yeah, but SubSonic's out on CodePlex. That's good enough, right?

Why does Microsoft need to get involved? Why not just let it hang out on CodePlex and write a little blurb on the ASP.NET site? Because most Microsoft developers only use what's in the box. Even if the developers want to use it, their bosses or co-workers will shy away from "that crazy blogger open source stuff." DotNetNuke took years to build the following it has, and even still it's not nearly as well known as Atlas, a relative newcomer to the ASP.NET toolbox. By adding this to the Microsoft endorsed ASP.NET toolkit, millions of developers would actually start using it.

Atlas? What's that got to do with a data abstraction layer?

Well, it makes sense for a few reasons:

  1. Atlas is at just the right place in the product lifecycle. It's positioned as an official "extension" of ASP.NET. It's got the Microsoft seal of approval, but it's still a separate download at this point.
  2. SubSonic needs some AJAX glitter to fare well against ROR, and Atlas could benefit from a great Hello World demo-ready application. The two are made for eachother if you look at things from the where the web development world is at, rather than how the Microsoft development tools are positioned. The Atlas website says Atlas is a free framework for building a new generation of richer, more interactive, highly personalized cross-browser web applications. SubSonic fits in well with that description. Imagine the demo you could pull off with a zero code data abstraction layer, a scaffold in an UpdatePanel, and some Atlas controls bound to SubSonic populated datasources; imagine how efficiently you could wow a client. Atlas with SubSonic would make a killer combo.

But, isn't SubSonic an open source kind of project?

It's licensed under the Mozilla Public License, which is pretty simple - you can use, redistribute, and even sell software using MPL'd code, but if you modify the MPL'd code you have to publish your changes. It's not like the "viral" GPL, which requires that you GPL your software to make use of GPL'd code. So, to say this in English, I believe that Microsoft could bundle the SubSonic DLL with Atlas, and the most they'd need to do is include a clause in the Atlas EULA stating the SubSonic code is under the MPL and the source code is available on CodePlex. They'd be free to make any changes to SubSonic as long as they released them on CodePlex, which doesn't seem like it would be a problem.

But aren't there already better implementations of Ruby on Rails for ASP.NET?

Yeah, there's MonoRail. Watch the screencast; from what I've seen I like SubSonic a lot better. SubSonic doesn't just tack ROR onto ASP.NET, it learns from it but plays smart with the .NET framework. It leverages the build provider capability, the code behind model, the server control system, etc. Rather than taking over the project with tons of added code, it adds classes which are invisible until you use them. It seems like a MonoRail project is a MonoRail project, whereas a SubSonic project happens to use SubSonic where appropriate, and can factor it out where appropriate.

But didn't this just come out? You're nuts to be talking about shipping it!

Well, yeah. Of course Microsoft would want to review the code to make sure that it's up to snuff. However, Rob Conery (the author) is the Chief Architect of the Commerce Starter Kit for ASP.NET 2.0 and an ASP.NET MVP with a great track record. Why not contract with him for 3 months to buff it out a bit?

</crazy-talk>


1Ruby on Rails advances some great web development values, but it seems like a lot of work compared ASP.NET 2.0, especially if you're using some code-gen, ORM's, or frameworks. You're left writing a lot of markup, and it's the spaghetti code kind of markup (code meatballs mixed with HTML markup noodles) that drove me nuts with "Classic ASP" and PHP. I really like the code behind approach in ASP.NET, and I definitely prefer C# and Visual Studio.NET to Ruby and a text editor that may have ROR syntax support, but no designers. Then there's the extension story - I haven't used the ROR corelib, but it sure looks like it's a lot less powerful than the .NET framework.

2No, I'm not dissing ROR. I know it runs Basecamp and a bunch of other big applications. However, I think if you compare the feature sets of ROR and ASP.NET you'd agree that ASP.NET seems better suited for enterprise applications.


I'm having trouble posting comments, so here are my replies to the comments below:

@Colin:
1. All the ActionPack bashers are upset because it's not doing the whole ROR MVC thing. Bah. ActionPack / SubSonic isn't ROR for ASP.NET, is's a better way of doing things with ASP.NET. MonoRails has a place in the full blown MVC pattern approach to web development; I'm not knocking that. SubSonic is great because it works with and augments what ASP.NET does in the way it works.

2. Not sure what your point was about ASP.NET developers not being web developers, etc. I've done a lot of web development over the past 10+ years, and I believe that less code is generally a good thing from a maintenance perspective. Those who will only use the designer and don't understand the markup would probably benefit from a simple DAL system rather than hand writing their own code or having to set a lot of properties in various server and web controls. One nice thing about this approach is that it scales - you can quickly build out a site with SubSonic, then convert SubSonic DAL code use another form of data access (hand written / NHibernate / EntLib you name it) without any structural changes. It seems like you might be upset about the markup that ASP.NET generates, which doesn't really make sense in reference to server side data access.

3. You don't really explain yourself on the last point about enterprise development. My point is that ASP.NET has a good offering for large or complex sites (MySpace, Nasdaq, many banking systems, etc.). I'm sure ROR could potentially do those kinds of jobs, but it would take a lot more work to do and code to maintain.

@David
I never really liked the strongly typed DataSet approach. Your build provider approach to them might make that better, but I'd still much rather code against DataReaders. SubSonic's DAL gives you quite a bit more than a DataSet provides, too - dynamic query, scaffolding, etc. Regarding requiring data access, I'm not sure that's true. SubSonic could build out your DAL when it is connected, and not build it when it's disconnected. I don't know if it supports that right now, but if it doesn't it doesn't seem difficult to unwire it when you're disconnected.

@Andy
My original post just said that Microsoft should ship SubSonic, but how exactly would they do that? It's an open source project; it would look wierd to try to release it separately. So then I wrote that Microsoft should ship SubSonic with the next release or update to ASP.NET, but when will that be? Microsoft ususally doesn't push out new functionality with smaller updates, so it wouldn't be until a service pack or the next ASP.NET release, and when will that be? Then I was thinking that it needed to be something on the same level as Atlas, but since it's just one DLL, why not just drop it in Atlas?

Regarding Microsoft shipping something like Castle or another ROR framework, I'm not so sure. If they did, I'd suspect it would be a large p&p EntLib like release, which doesn't fill the same niche that SubSonic does - minimal code to get data on the screen.

@Scott
BLINQ looks cool, but a command line generator is not near as clean as a build provider. Also, it looks like it generates a lot of code [ http://forums.asp.net/thread/1346141.aspx ]; SubSonic builds the DAL without adding the code to your project. Maybe BLINQ should add a build provider?

Published Wednesday, August 30, 2006 12:51 AM by Jon Galloway

Comments

# re: Microsoft should ship SubSonic (formerly called ActionPack) with Atlas

Jon,

I watched the webcast, and it definately looks like a nice project well done by Rob.

For your readers you should point out that in ASP.NET 2, the strongly typed dataset pretty much does a chunk of that and is now also a build provider; so you just drop your .xsd file into your app_code directory, and the same magic happens: Classes that get generated at runtime by ASP.NET, and no ugly code cluttering up your project.  This was a big improvement from ASP.NET 1.  You even get the default adapters to query, etc.

As Rob explained, his and ROR methods use convention rather than configuration...So you might not like the amound of configuration XML in the strongly typed dataset .xsd file.

But I would say:  If that is an issue, the first thing someone should do is write a 1 page build provider that simply wraps up the current build provider and lets you specify the tables you want included like what Rob did:

* (for all tables)

or is you want just two tables:

Products

suppliers

You could then just kick back to the standard ASP.NET infrastructure via your build provider and assist people learning it.

I wrote a few build providers back in 2003 when ASP.NET 2 first came out as a CTP, so might have a crack at it for you.

Not trying to discourage Rob, as his work is great.  I just did not see enough value add from the video, particularly with LINQ being much more general and around the corner.

Hope that helps.

Wednesday, August 30, 2006 6:51 AM by David Taylor

# re: Microsoft should ship SubSonic (formerly called ActionPack) with Atlas

Jon,

I meant to add to my last comment, that there are obvious benefits and disadvantages of the Microsoft Strongly typed dataset approach, storing configuration in the .xsd file, and the ActionPack approach.

The problem with ActionPack is the build provider needs to hit the database live, so if you want to code while on the plane you better have the database on your laptop otherwise you will not even be able to hit compile.

The benefit of storing more configuration in the .xsd is you can compile while on a plane and not online without access to your DB.  The disadvantage is more configuration needs to go into the .xsd file - but more flexibility as well.

Wednesday, August 30, 2006 6:55 AM by David Taylor

# re: Microsoft should ship SubSonic (formerly called ActionPack) with Atlas

ScottH: BLINQ looks nice. It sounds like a skunkworks project inside of Microsoft. But it depends on technology that is just in the CTP stage and won't be out until Orcas is released. All of these RoR knockoffs (and knockUPS! like SubSonic) allow folks to get work done today while reducing the pain of using .NET data access.

Wednesday, August 30, 2006 2:09 PM by Scott

# re: Microsoft should ship SubSonic (formerly called ActionPack) with Atlas

I tend to agree with Scott on not waiting on BLINQ. Both RoR and Java (via the persistence API) are miles ahead of Microsoft on making data access... well, accessible. With respect to the market readiness of Atlas and SubSonic, I believe that people are slowly getting accustomed to permabeta. Folks have learned to partition their brains into production worthy and not-quite-production-worthy partitions.

Thursday, August 31, 2006 11:37 AM by Thomas Beck

# re: Microsoft should ship SubSonic (formerly called ActionPack) with Atlas

Subsonic is a great tool. I did an e-commerce project recently and had to dive deep into the code to modify core functionality. In the process I had to regenerate DAL classes with subsonic and had code partial classes to provide added methods to the classes. Awesome tool!. I however would like to see a subSonic version without Enterprise Library

Wednesday, May 16, 2007 9:04 AM by Fargii

# re: Microsoft should ship SubSonic (formerly called ActionPack) with Atlas

Hey,

I like Subsonic already, just by watching the vids.

I also think that the name is OK, and I think it has the vibes to be adopted in granularly  fashion.

We use Nettiers, that aint fun so much...

Cheers,

Trab.

Friday, August 17, 2007 5:12 PM by Trab

# re: Microsoft should ship SubSonic (formerly called ActionPack) with Atlas

Joining the Subsonic bandwagon today

Monday, December 29, 2008 7:36 AM by Micky