- An extention to a standard general-purpose type like int, double, String, etc that constrains the domain of possible values to the actual business domain. When I declare a String property as not null and having at most 16 characters, I actually give a hint to the framework to force the corresponding restriction on assigned values. Alternatively I could probably declare a new type like NonNullString16 and use it instead. Possibly a good example is the price of some asset that should never be less than zero. This requirement can be captured by NonNegativeDecimal type or even more specialized AssetPrice type. However, building a custom type for every particular situation seems rather irrational and hardly doable in most cases dut to a number of technical problems.
- A complex check on several properties correlated by some law. Examples:
for an employee the graduation date cannot precede the date of birth, for a market quote bid price cannot be higher than offer price, the number of idle resources cannot exceed the overall pool size, etc.
"I'm just sitting here watching the wheels go round and round, I really love to watch them roll..." John Lennon
Thursday, January 14, 2010
Thoughts on validation
Would I miss anything if I guess that a validation rule applied to a single entity can be either of the two:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment