This project is read-only.

Thinking About Changing Generation Method

Sep 17, 2009 at 9:14 PM

Right now the horribly named FIllme Class uses the supplied default value to determine if the generator should be called or if the default value is simply returned.  I'm thinking of moving this to the actual generator itself.

So Generate would have an overloaded method that accepted something as a parameter  and returned that

Generate(Random random) - would return the random name but
Generate(String firstname) - would just return the firstname parameter

This would allow moving the decision making a little deeper into the call stack.

Thoughts?

Sep 17, 2009 at 9:32 PM
I think that's a great idea. It seems to move thinks closer to the
strategy pattern... I also think that with some thought one could
refactor the approach top remove some apparent duplication. I'll try
to send you some ideas on it soon.

Scott

On 9/17/09, webjedi <notifications@codeplex.com> wrote:
> From: webjedi
>
> Right now the horribly named FIllme Class uses the supplied default value to
> determine if the generator should be called or if the default value is
> simply returned. I'm thinking of moving this to the actual generator
> itself.So Generate would have an overloaded method that accepted something
> as a parameter and returned thatGenerate(Random random) - would return the
> random name but
> Generate(String firstname) - would just return the firstname parameterThis
> would allow moving the decision making a little deeper into the call
> stack.Thoughts?
>
>

--
Sent from my mobile device
Sep 17, 2009 at 9:44 PM
Have you ever seen SQL data generator from RedGate? Its a robust tool
to do similar work against a database. Interesting to consider the
similarities with what we're thinking about with ObjectHydrator.

Scott

On 9/17/09, webjedi <notifications@codeplex.com> wrote:
> From: webjedi
>
> Right now the horribly named FIllme Class uses the supplied default value to
> determine if the generator should be called or if the default value is
> simply returned. I'm thinking of moving this to the actual generator
> itself.So Generate would have an overloaded method that accepted something
> as a parameter and returned thatGenerate(Random random) - would return the
> random name but
> Generate(String firstname) - would just return the firstname parameterThis
> would allow moving the decision making a little deeper into the call
> stack.Thoughts?
>
>

--
Sent from my mobile device
Sep 17, 2009 at 10:16 PM
ScottMonnig wrote:
I think that's a great idea. It seems to move thinks closer to the
strategy pattern... I also think that with some thought one could
refactor the approach top remove some apparent duplication. I'll try
to send you some ideas on it soon.

Scott

That's what I was thinking too...I also have an unfinished method in there that accepts a previously created instance of the object and only attempts to generate the missing values.

So one more round of tests (integration this time...just added unit tests for each generator specifically, with some RegEx thrown in to validate), finish that partialy filled class method and then refactor to eliminate duplication and we should be close to a .1 release...from there adding the remaining generators...increasing the scope and dictionary sizes for the generators and it's in pretty good shape I think.

 

Sep 17, 2009 at 10:19 PM

ScottMonnig wrote:
Have you ever seen SQL data generator from RedGate? Its a robust tool
to do similar work against a database. Interesting to consider the
similarities with what we're thinking about with ObjectHydrator.

Scott

 Yeah it's a pretty good product.  That was part of the inspiration for this project.  I haven't seen it in a few versions but I imagine it could be very complementary to this project once you get to the DB part of the project.  I'll have to check it out again one of these days.

Ryan

Sep 18, 2009 at 12:15 AM

Began the refactoring of the Generators so they can be more flexible...and began to move the check for a default value from FillMe into the Generator itself.  This will clean up the FillMe class a lot...plus make the Generators better.