HR Scala Meetup / Studeni 2016.

For this session, we are going to compare and contrast the different types of validations that are available in the Scala ecosystem.

Although we will start by warming up and showing basic usages of Either/Try, soon we will come to a realization that validation libraries are necessary to cover our of need to accumulate errors in a fashion which would be difficult with just vanilla constructs from the standard library.

We will start off by going through the functional aspects of these validation libraries and how they could be used in real use cases:

• ScalaZ: http://eed3si9n.com/learning-scalaz/Validation.html

• Cats: http://typelevel.org/cats/datatypes/validated.html

• Scalactic: http://www.scalactic.org/user_guide/OrAndEvery

Much function, so Validated – but do these come at a price?

We’ll get down and dirty and show benchmarks for how much overhead these libraries introduce. As we are exploring these overheads, we will also need a way to measure these without using a stopwatch 🙂

This is where SBT plugins and microbenchmarking frameworks (i.e. JMH) come along – so there will be a microbenchmarking diversion which is applicable to all languages running on the JVM.

One thing that is almost painfully obvious (especially when working on large codebases) is that there are also non-negligable compile time overheads of using these libraries.

This is why we will create a reproducible sample code and run each of the validation frameworks to see how much time we waste during compilation.

više