5 Reasons why SubSonic is Better than Sliced Bread

October 26, 2007 10:01 by Dominick

Toast your bread before you put gravy on it. Use SubSonic in your applications.

1. It gets better with age

There are still things that I discover almost on a daily basis that I didn't know it could do. One of the coolest features I've discovered lately is the built-in table relations it implements in its generated classes. You can very easily reference a related record in another table with a tiny bit of code. Check this out.

//grab a product object
Products product = Products.FetchByID(productId);

//if you have a relation setup to a Vendors table you can do this
//the Vendors table has an Address field for the vendor
String vendorAddress = product.Vendors.Address; 

How rediculously simple is that?

2. It doesn't make you fat if you use it too much

The more you use it the more time it will save you. Your developement will get faster not slower. Its the ultimate DAL generator that just makes things faster and easier to do.  It doesn't create tons of useless code either. You can even tell it to only generate the class files on the tables you want it to. I can honestly say that I write about 1/4 less code than I used to because of SubSonic. 

For example this is just one way to generate a collection that you can bind to a data countrol.

//this one line of code will populate a collection of products with a specified vendorId
ProductsCollection coll = new ProductsCollection().Where("VendorId", vendorId).Load();

3. It won't get soggy if you pour gravy on it

That has nothing to do with SubSonic, but I just hate when my bread gets soggy. A restaurant should know that they need to TOAST the bread before they pour gravy all over it. Why can't they understand this simple concept?

As far as SubSonic goes... if you consider the ASP.NET AJAX framework as gravy and the generating of the class files during compile as toasting than no, it won't get soggy. They work perfectly well together. 

4. If you want to change something about it you don't have to buy a whole new loaf

I see two meaning with that statement. First, its open source. Rob and Eric do a wonderful job, but if you don't like something about it or want to add something new than go right ahead and do so. The wonderful thing about open source is you don't have to depend on anybody else to fix a bug if you don't want to. We'll not talk about having bugs in your bread. The other is that if you need to change something in your database you don't need to manually change your DAL code. Make a change in the database, recompile, you now have access to the changes in your application. 

5. Transparency is a good thing

As a developer using SubSonic you really need not worry about what's going on under the hood. You can be as oblivious as you like. It works best when you let it be transparent. Make it a part of developing the majority of your applications and your life will be better for it.

Bread would have to be really really soggy to become transparent. That is something that most certainly would not make your life better.

kick it on DotNetKicks.com



Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading