A faily simple but common task across all application code that i have written is simple validation of parameters and inputs. Everybody has thier own way of handling this and here is mine. Can I do it better ? You Bet.

 

https://gist.github.com/PradeepLoganathan/bc4ae7daf64d5db4c4912000148011e2