Should parameter validation be configurable?

Topics: Developer Forum, Project Management Forum, User Forum
Coordinator
Oct 2, 2008 at 3:22 PM
Whats the use case where parameters should be configurable? How are people using this feature? Maybe in a WCF scenarios?

This is what I'm thinking: It seems like parameter validation is really within the scope of the method writer.

I'm thinking of making a more robust Guard feature. This feature would allow method writers to leverage validators (one we merge research branch) but in an explicit, non configurable, way.

Objections?
Coordinator
Oct 2, 2008 at 9:11 PM
Edited Oct 2, 2008 at 9:14 PM
i have an objection :)

This scenario would not support xml configuration and hence not allow the separation of data model assemblies and validation logic.
Coordinator
Oct 2, 2008 at 9:17 PM
That's the point. Should param's even be configurable? If not then we don't even need to support it and can simplify the xml part of the framework. We would still allow method writers to leverage validations via guard.

Just playing devils advocate: What are the use cases for param validation?
Oct 2, 2008 at 10:21 PM
To be honest I can't really think of an adequate use-case for parameter-based validation that's not a contrived example.
Coordinator
Oct 2, 2008 at 11:15 PM
Edited Oct 2, 2008 at 11:18 PM
How about calls to a service that has an agreed contract such as web service, wcf and remoting calls?
Coordinator
Oct 3, 2008 at 1:15 AM
BTW here is an example of how you validate properties in castle that a friend pointed out to me.
http://using.castleproject.org/display/Contrib/Castle.Facilities.MethodValidator
Coordinator
Oct 3, 2008 at 1:29 AM
Edited Oct 3, 2008 at 1:29 AM
Yeah, I'm looking to get advice from someone who uses these rules in a wcf or remoting scenario. So if anyone is using it in those scenarios please chime in (though this might not be the most visible spot).

Its true many validation frameworks support param validation (EntLib, Castle, etc.) however, to me, this doesn't make it a good design decision. I just wanted to hash out the rational for providing support for it. Worse case scenario we spend time supporting something that gets developers into trouble and we complicate the framework.

 

I've not spent much time with remoting or wcf so I just want to see the use cases for this and brainstorm other solutions. If there aren't any other solutions then we continue in the same direction.