Nice class, but I have one suggestion:
Wouldn't it be better to implement custom validation by means of Delegation than Subclassing?
I suggest to use the Strategy-Pattern.
Maybe different strategies should then be chainable.
|2012-09-13 15:24:25 - In reply to message 1 from Anon Ymous|
|I guess it depends on personal preferences.|
Personally I would rather not be passing yet another parameter to the class just to make it call a separate class for custom validation. Calling a function of the same class avoids the need for that extra parameter.
In any case, if you prefer to delegate to a separate object for some reason I do not envision now, you can always call it from the sub-class.