Object Hydrator fills your objects with random data...on purpose!

First off...long time since I've last written...yeah I guess frequent blogging isn't my thing.

But I wanted to post this to solicit feedback from the community about something I've been thinking about lately.

Call it DDD, BDD, TDD or a bananna there is a lot of merit in approaching a new application, from an angle other than the database and how you're going to persist the data.  If you've been building applications long enough, you know that data access (in any form) is one of the most repetitive and code heavy features of your application.  I called it a feature because it really is...and with all features, you're smart to delay the building of the feature until last responsible moment.  This allows you to garner the maximum knowledge of said feature.

What if we could build 'working' applications, that demonstrates the solution to the particular business challenge we are trying to solve...*without* a database at all.  Well at least until it makes sense to.

Rob Conery's SubSonic has a fantastic feature called the SimpleRepository.  This allows you to save any object into a database without having previously created a table and without having done the alphabetical gymnastics of mapping said object to the database.  It just saves it.  This mimic's closely the concept of the object centric database functionality of db4O etc...  I think it's brilliant but what if we could delay that decision even longer still.

What if we could design our object, and pass it through a ''generator" that returned us that object filled with data that mimicked real world data.  What if it could return a collection of these objects?  Theoretically we could be repositories that acted like databases, but since we hadn't yet commited to a database structure we have the flexibility of tweaking those objects at will.

What we end up with is an interface and business objects that behave like they should, that demonstrate the intent of the application without having to commit to a persistence strategy until nearly the end of the project.

I didn't have any luck finding this out there already...so to that end I started Object Hydrator...it's free and up on CodePlex in source form.  It will allow you to create data filled objects during runtime. I think it could have a lot promise when it comes to TDD and DDD/BDD/R2-D2.  It currently works with two methods...you can add attributes to your object's properties, or you can use a mapping collection.

So if it interests you, feel free to go check it out and look at the tests to see it in action.  It's still a veritable infant, so keep that in mind, but please let me know what you think about its usefulness and the code itself.

Published Monday, September 14, 2009 9:13 AM by ryansjedi
Filed under: ,

Comments

# Object Hydrator fills your objects with random data...on purpose! - Ryan Smith@ Monday, September 14, 2009 12:43 PM

Pingback from  Object Hydrator fills your objects with random data...on purpose! - Ryan Smith

# Object Hydrator fills your objects with random data…on purpose! | I love .NET!@ Monday, September 14, 2009 2:08 PM

Pingback from  Object Hydrator fills your objects with random data…on purpose! | I love .NET!

# Twitter Trackbacks for Object Hydrator fills your objects with random data...on purpose! - Ryan Smith [asp.net] on Topsy.com@ Tuesday, September 15, 2009 5:07 AM

Pingback from  Twitter Trackbacks for                 Object Hydrator fills your objects with random data...on purpose! - Ryan Smith         [asp.net]        on Topsy.com

# re: Object Hydrator fills your objects with random data...on purpose!@ Tuesday, September 15, 2009 10:38 AM

Sounds interesting. How would it handle aggregates (dependent objects/referential integrity) type situations?

# re: Object Hydrator fills your objects with random data...on purpose!@ Tuesday, September 15, 2009 11:39 AM

Not sure yet...I want to support those, but in the very short term...I'm doing that in my fake repositories.

I have a vague notion of how it could go...I'll be prototyping that as soon as I have a slightly larger set of generators...right now there are about eight...I know of two more I need to finish (currency and boolean) which will be super simple.  And then there was a request for Enums that I'll take a look at.

Leave a Comment

(required) 
(required) 
(optional)
(required)