My team at Canal+ is building a new media asset management (MAM) platform. To put it simply, Mediahub, our platform, stores video files and information regarding these files: Technical information (how many audio channels does this video have? what’s the video’s resolution?) Editorial information (is it a movie? A show? A TV series episode? Who is speaking in the sequence? What about?) Legal information (when can we air this content?
This tutorial covers Circe, a functional JSON handling library for Scala, part of the Typelevel ecosystem and well integrated with Cats. To learn more about Circe: https://github.com/circe/circe To learn more about Monads and Applicative functors: https://www.youtube.com/watch?v=Tx5Ld... To learn more about Type classes: https://typelevel.org/cats/typeclasse... The video covers: 00:00 The overall structure of the library 04:43 The Json data type 13:51 Encoders 17:14 Decoders 30:39 Automatic derivation 32:33 Semi-automatic derivation 34:55 Automatic derivation considered harmful and conclusion A note about the placement of Json codecs and the “automatic derivation considered harmful” part of the video: placing our Encoder[YoutubeVideo] in the companion object of YoutubeVideo would have solved the problem.
The way we deal with failure in most OOP applications is itself a common source of unexpected behaviors. I believe exceptions and try/catch statements are overused. Most of the time, it isn’t obvious what a method might throw and when. Edge cases should be treated with the same amount of caution, if not more, than the rest of the code, yet they are rendered invisible by error-handling mechanisms that hide failures instead of highlighting them.