Book Image

Scala Intermediate Recipes [Video]

By : Antonio Salazar Cardozo
Book Image

Scala Intermediate Recipes [Video]

By: Antonio Salazar Cardozo

Overview of this book

Now that we have the easy stuff out of the way, we take delve into some of Scala's more powerful features. Pattern matching is Scala's tremendous ability to deconstruct data in intuitive and readable ways, letting you write safely in a few lines of code what other languages can take tens of buggy lines to get across. We'll explore the various ways that patterns can be used, as well as some of the more advanced functionality that they hide. A quick detour into testing will introduce the specs2 library and how to use it to do behavior-driven development in Scala. Then we'll dig into Scala's collections some more; Scala's collections library is vast, and holds many powerful tools for dealing with data. Finally, we'll go through a few tricks that let you get readable and type-safe frameworks in place to describe your domain.
Table of Contents (4 chapters)
Chapter 4
Intermediate Scala Tricks
Content Locked
Section 1
Trait stacking and abstract override
In this video, we will create traits that can be stacked to provide interlocking functionality. - Construct traits that can reference an unimplemented super method - Add a base trait to provide the fallback implementation - Understand the dangers of stacking traits