M
Mike Hofer
I like it. It's better. What about Parameter instead of ParamRule?
Oh, and Parameter it is.
I like it. It's better. What about Parameter instead of ParamRule?
Oh, and Parameter it is. - Hide quoted text -
- Show quoted text -
Scott M. said:I agree and I believe it's better OO to do so. Classes get noun
names, methods get verb names, properties get adjective names, [...]
Anyone please tell me where to download NValidate?.
- Show quoted text -
The Alpha Release of NValidate will be uploaded tonight. THIS WILL NOT
BE PRODUCTION READY CODE. It's being released for public review.
However, since it's being released under the GPL, you're free to fix
any bugs you find and run with it.
Just don't expect to be able to sue me if it blows your foot off.
The web site's been expanded to include the API reference and
community forums. You can find them athttp://www.nvalidate.org. Note
that the docs have some holes in them; they'll be fixed tonight as
well. (I'm posting this from work.)
Thank you for your interest!!
The Alpha Release of NValidate will be uploaded tonight. THIS WILL NOT
BE PRODUCTION READY CODE. It's being released for public review.
However, since it's being released under the GPL, you're free to fix
any bugs you find and run with it.
Just don't expect to be able to sue me if it blows your foot off.
The web site's been expanded to include the API reference and
community forums. You can find them athttp://www.nvalidate.org. Note
that the docs have some holes in them; they'll be fixed tonight as
well. (I'm posting this from work.)
Thank you for your interest!!
Brian Gideon said:Mike,
I downloaded it and gave it a brief test drive. The API is pretty
much how I envisioned it would be. I really like how similar the
"feel" is to NUnit's API. I think Demand is a great name for the
factory class and I'm actually glad that you decided against having
that ParamRule static class as portal to get to Demand.
You know...it's use cases might not just be limited to parameter
validation. I'm thinking that it could be a complelling solution for
a lot of different things including Debug.Assert, user input
validation, etc. I'm not sure how narrow of a scope you want to keep
for the project though.
Brian
I was hoping you might
offer your opinion on that, now that you've had an opportunity to look at
it.
Regarding the dropping of the ParamRule "domain": I'm very pleased that it
was dropped. It seemed unnecessary, and I simply couldn't justify it. It was
an entire class with one property on it:
I do have one concerned raised by a member on the NValidate forums. He's
concerned that creating lots of objects just to validate parameters might
negatively impact the application's performance. I was hoping you might
offer your opinion on that, now that you've had an opportunity to look at
it.
Before you do though, I'd like to offer the following points:
1. I specifically split the validators into two groups, derived from two
different base classes so that boxing and unboxing would not occur when the
value of a value type parameter was cached within the validator itself.
2. Only one validator is created per parameter. If the caller chains the
tests together (as intended), the same validator is reused over and over
again.
3. Each validator only holds two pieces of information: the name of the
parameter (a string), and the value of the parameter. So we're not keeping
lots of data in memory.
4. The validator's test method must conduct its test and either throw an
exception if the test fails or return a reference to the validator. The
tests are written to be as fast as possible. (If they're not written that
way, that's a defect and needs to be resolved.)
5. I avoided reflection and attribute-driven solutions because they tend to
be slower. (Reflection requires loading and parsing an assembly's manifest;
attribute-driven solutions require reflection.) The sole case where I use
reflection is in the IsValid test on the EnumValidator.
So those are the performance-measures I took when designing the framework. I
realize that we're going to have to just test the thing and measure the
impact and provide raw numbers at some point. But my gut feeling is that the
number and complexity of the objects were creating is so small compared to
the number and complexity of other objects created throughout the lifetime
of an application (or even within a method) that the impact will be minimal.
Again, I fully agree that testing must be done to prove this and fix it if
it's not true.
I do have a solution in mind if we think this will be a serious problem. I'd
just like to get a feel for whether or not it's worth redesigning the
framework or not.
Regarding the dropping of the ParamRule "domain": I'm very pleased that it
was dropped. It seemed unnecessary, and I simply couldn't justify it. It was
an entire class with one property on it:
I do have one concerned raised by a member on the NValidate forums. He's
concerned that creating lots of objects just to validate parameters might
negatively impact the application's performance. I was hoping you might
offer your opinion on that, now that you've had an opportunity to look at
it.
Before you do though, I'd like to offer the following points:
1. I specifically split the validators into two groups, derived from two
different base classes so that boxing and unboxing would not occur when the
value of a value type parameter was cached within the validator itself.
2. Only one validator is created per parameter. If the caller chains the
tests together (as intended), the same validator is reused over and over
again.
3. Each validator only holds two pieces of information: the name of the
parameter (a string), and the value of the parameter. So we're not keeping
lots of data in memory.
4. The validator's test method must conduct its test and either throw an
exception if the test fails or return a reference to the validator. The
tests are written to be as fast as possible. (If they're not written that
way, that's a defect and needs to be resolved.)
5. I avoided reflection and attribute-driven solutions because they tend to
be slower. (Reflection requires loading and parsing an assembly's manifest;
attribute-driven solutions require reflection.) The sole case where I use
reflection is in the IsValid test on the EnumValidator.
So those are the performance-measures I took when designing the framework. I
realize that we're going to have to just test the thing and measure the
impact and provide raw numbers at some point. But my gut feeling is that the
number and complexity of the objects were creating is so small compared to
the number and complexity of other objects created throughout the lifetime
of an application (or even within a method) that the impact will be minimal.
Again, I fully agree that testing must be done to prove this and fix it if
it's not true.
I do have a solution in mind if we think this will be a serious problem. I'd
just like to get a feel for whether or not it's worth redesigning the
framework or not.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.