Image for post
Image for post

Accord is an interesting lib for validations. Accord is composable, simple, self-contained, and integrated with ScalaSpecs for instance. In Java, validations are often done via annotations. In general, there is an abuse of annotations in Java mostly because there is a lack of Macros which we have in Scala and Rust for instance. I really like the Accord approach to validations where we dont throw Exceptions and we can extend and re-use validations across the type system. So today I made a simple code with Scala and Accord using SBT as-built system and a video to explain in more detail. So let’s get started.

The Video

The Code

Cheers,

Diego Pacheco

Originally published at http://diego-pacheco.blogspot.com on January 10, 2021.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store