Book Image

Professional Scala

By : Mads Hartmann, Ruslan Shevchenko
Book Image

Professional Scala

By: Mads Hartmann, Ruslan Shevchenko

Overview of this book

This book teaches you how to build and contribute to Scala programs, recognizing common patterns and techniques used with the language. You’ll learn how to write concise, functional code with Scala. After an introduction to core concepts, syntax, and writing example applications with scalac, you’ll learn about the Scala Collections API and how the language handles type safety via static types out-of-the-box. You’ll then learn about advanced functional programming patterns, and how you can write your own Domain Specific Languages (DSLs). By the end of the book, you’ll be equipped with the skills you need to successfully build smart, efficient applications in Scala that can be compiled to the JVM.
Table of Contents (12 chapters)

Chapter 2. Basic Language Features

In the previous chapter, we learned the various aspects of setting up the development environment wherein we covered the structure of a Scala project and identified the use of sbt for building and running projects. We covered REPL, which is a command-line interface for running Scala code, and how to develop and run code over the IDEA IDE. Finally, we implemented interactions with our simple chatbot application.

In this chapter, we will explore the so-called 'OO' part of Scala, which allows us to build constructions similar to analogs in any mainstream language, such as Java or C++. The object-oriented part of Scala will cover classes and objects, traits, pattern matching, case class, and so on. Finally, we will implement the object-oriented concepts that we learn to our chatbot application.

Looking at the history of programming paradigms, we will notice that the first generation of high-level programming languages (Fortran, C, Pascal) were procedure oriented...