General Design Question - Class Name

  • Thread starter Thread starter Mythran
  • Start date Start date
M

Mythran

I'm in need of some suggestions. Currently, we have a class that is named
StringValidator. It has methods such as ValidateMaxLength,
ValidateMinLength, IsNumber, IsMatch, ValidateNumeric, ValidateInteger, etc.
There is custom validation for each method (such as IsNumber compared to
IsNumeric) and overloads (lots) for each that allow passing a string, a
DataRow and ColumnName, a DataColumn and DataRow, etc. The suggestion(s) I
am in need of is a class name that better suits it.

StringValidator just doesn't sound right to us and I would like some
alternative ideas for it :)

Our namespace is MCIS.Libraries.Validation and the class would go under this
(which will probably be changed to MCIS.Libraries.Data.Validation). So
Validation would not be a good name for the class either :)

Thanks,
Mythran
 
Mythran said:
I'm in need of some suggestions. Currently, we have a class that is named
StringValidator. It has methods such as ValidateMaxLength,
ValidateMinLength, IsNumber, IsMatch, ValidateNumeric, ValidateInteger, etc.
There is custom validation for each method (such as IsNumber compared to
IsNumeric) and overloads (lots) for each that allow passing a string, a
DataRow and ColumnName, a DataColumn and DataRow, etc. The suggestion(s) I
am in need of is a class name that better suits it.

I'd get rid of it...

Instead have a family of static functions which produce Regex strings
to check for MaxLength, MinLength, IsNumber, ...

As for DataRow/whatever, what you're doing is unrelated to validation.
Instead you're producing "map/fold"-like adapters which work over
various kinds of data structures. So these could be more abstracted.
 
Back
Top