Thoughts on Web Development with ASP.NET Dynamic Data, Castle Active Record Part 2

In the first part of this post back 24 days ago, I talked about the big shift I have been going through and working now in the world of the Web. I talked about working in a conservative Pharma environment and the data-driven simplicity of many of the ASP.NET applications we were building that took me away from my default DDD architecture. I also talked about a possible fit for ASP.NET Dynamic Data, and then the ActiveRecord Pattern, as well as Castle Active Record.

For the last five weeks, I have immersed myself in Castle ActiveRecord and I have loved it! Moreover, it has proven to be an excellent solution for a medium-sized Web application we are building. It has provided an excellent Ruby on Rails alternative for .NET.

There are also a number of factors here. One, as I mentioned, in Part 1, is As many in the ALT.NET community and elsewhere, I  converted from being a Data-Driven Architect to modeling the business and using a Data Mapper [Fowler] a.k.a OR/M to persist to Resource Layer. I am simply not going back. I am sick of 26 years of writing SQL database code and particularly writing Data Access Blocks or using them. It's just not a good approach and its a huge waste of time and productivity. I prefer to model the business with a rich DDD/OO layer instead and use DataMapper, O/RM. Another factor, is I am sick of generating Data Models in Visio and the like, and the whole BDUF approach of it all. We do that now where I work. Frankly, I am a pretty lousy data modeler but I am an excellent OO modeler and programmer with 26 years of C++/Java/C#/etc. So, I want a tool that will auto-generate my database schema. Out goes ASP.NET Dynamic Data and the Entity Framework V1. I need to start with the model, the OO classes, the database is secondary. Last factor is that in my Pharma company, we have a large BDUF approach (that we are trying to change) but now Technical Architects design Data Models, the architecture and classes, and the coding is farmed out to India. I know what you are thinking with my Agile background, but that is what it is like in Big Pharma and many large enterprises. I will have more posts on those challenges later. Anyway, I wanted something simple in an O/RM or a solution here. Castle ActiveRecord fit the bill perfectly. I also didn't want to deal with mapping files and some of the complexities of NHibernate. I just wanted real simple.

As I learned Castle ActiveRecord and developed my AR "layer" for my ASP.NET application, I/we begun to fall in love with it. It was natural for me to develop OO classes in C# and learn the Castle AR attributes and how to map database relationships, validation, and the like. It was natural to use NUnit to write tests and use the ActiveRecordStarter class to generate my schema and drop it at the start of every unit test. It took me about a week - 10 days to get really up to speed with it but now its really fast. So, in our process, there is a big handoff to offshore development. I was able to get three mid-level C# developers up to speed in AR in about three weeks. We have gone into "active development" with Castle ActiveRecord and it is our choice.

The interesting thing is I am on at least two other similar ASP.NET applications. I started one of those this week and it was supposed to be the big jump to VS2008/.NET Framework 3.5 SP1 and the Entity Framework for us. Know what? Forget it! I moved to .NET Framework 3.5 SP1 but Castle AR was working so well for us that I wasn't going to give up that simplicity for the hardship of Entity Framework and lack of database schema generation in V1. It took me about 3 weeks to both learn and code the whole AR layer for the first project. For the second ASP.NET project, which is larger, it took me a day and 1/2 to code the entire layer! Now that's productivity!

I hope, in the next post to get to some code.

Published 25 October 2008 01:18 PM by Sam Gentile

Comments

No Comments

Search

Go

This Blog

News

    The content of this site are my own personal opinions and do not represent my employer's view in anyway.

    Profile for SamGentile

MVP

Blog Information Profile for SamGentile

Tags

Archives

Syndication