|
|
|
|
|
by kstenerud
700 days ago
|
|
I think you may have misunderstood the article. The point of the article is to parse AND validate input AT THE BOUNDARY between the outside world and your program, rather than a bunch of ad-hoc validations at various points after the suspect data has entered the castle walls and has already been (at least partially) processed (thus making the program state harder to reason about). By enforcing your invariants at the border, you ensure that all data entering your system always conforms to your expectations, just like a strong type system ensures that invalid states are not representable. A schema is basically a type system for your raw data. This concept is also a major element of Domain Driven Design https://en.wikipedia.org/wiki/Domain-driven_design |
|