Pluck Me!

I'm working on a project now that is a rush job.  Gee, what's new.  Well, there's no project manager(read:anybody who can(should) successfully get us from point A to point B even if that means changing what point B means), and there's not much technical direction.  Luckily, there are about 7 developers, and no technical lead, so basically it's a free for all.  OK, fine. 

"The" Business Object

One developer added "The" business object, a single class containing one class per table in the database schema which is under constant change.   That's fine, unfortunately the "tool" generated 11,000 lines of code.  Again, no biggie.  The problem is that the code doesn't even do one thing, nothin.  They are classes with no more that one property for each field in the table that a class "represents".  That's it.  Funnily enough that didn't immediately pull a *WTF* to me, it was more of a "Huh?". There were no other classes that fill those classes with data or anything, just a bunch of models and that's all folks.

I was thinking that I would try to make some kind of use out of the code by making them all inherit from ActiveRecordBase, put on the right attributes and voila! Useful code.  However the schema is changing rapidly and there's no access to the magic tool that generated the classes in the first place.  So not wanting to be the maintainer of that code(there are almost 100 tables), I went in search of other solutions, determined NOT to write straight sql.

Just Use Brute Force...

I asked another developer working on the project what they were using for interacting with the database.  The response I got obviously spawned this post: "We don't have enough time, I'm just using brute force and writing straight sql and ado.net".

The Brute Force comment pulled a *WTF* from me.  That's reminiscent of the dot bomb days when you'd write your straight sql by hand for 25 hours a day and spent(read: wasted) most of your time maintaining that stuff and fighting every database change for fear of having to dive into your beautifully hand crafted sql. 

No Thanks...

Enter SubSonic

I'm a fan of the BuildProvider concept and building the data layer on the fly I learned about when SubSonic was just getting started.  I've rolled a similar approach as a proof of concept using castle's ActiveRecord for the data access.  Anywho, that sure seemed like the approach I wanted.  This was the first post I read by Rob on SubSonic and it's gotten VERY good since then.  Today I watched this screen cast and was sold on picking up the latest version and integrating in our solution.  I was instantly talking to the database without typing one line of sql.  If that's not "brute force" I don't know what is. 

"The Schema Changed and Now I Have to go Fix My Sql"

Huh.  I reran SubCommander and in approximately 15 seconds, my data layer was regen'd and all changes were now in my code.  Man, I should've used brute force.  Maybe next time...

kick it on DotNetKicks.com

 
Author: , 0000-00-00