TL;DR:
- parsers take less-structured data and try to turn it into more-structured data. They don’t always succeed, so all parsers need to handle failure.
- validating
throws away information as exceptions/errors, while parsing holds onto that information - parsing inputs as early as possible helps you trust the validity of data once it reaches your business logic.
- Beware of “shotgun parsing”: validation checks scattered throughout a codebase. “Shotgun parsing necessarily deprives the program of the ability to reject invalid input instead of processing it.”
Or, more succinctly,
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.