Sunday 10 June 2012

Validation: Non-breaking Error Handling

Non-breaking error handling was covered in few nice articles and presentations. Was reading one from Tony Morris. Solution for validation is looking little bit overcomplicated for me. 
Validation is a good example where non-breaking behaviour can be applied. Thinking on validation framework under application flow with immutable object states - may be this is a great idea for new Validation framework.Lets start from Validation, still duel nature, but Success doesn't has any state and Failure contains the list of errors. Failure is Monadic Zero but it has state and can change the state during "add" operation with help of Semigroup and Context Bound.

We will present errors via List[String]: Quickly introducing immutable structure with lenses that comes from Scala: Lenses:
Validation functions: And finally the way to use it: What isn't done - the way how to link (DSL?) validations to lenses, without reflection or attributes. Are there any ideas?

No comments:

Post a Comment