Part 1. Scala: the basics

First things first.

In Scala in Action, chapter 1 focuses on Scala and why you should pick it as your next language. You’ll learn how Scala’s high-level features compare with programming languages you may be very familiar with. If you’re an object-oriented programmer, you’ll quickly get comfortable with Scala; if you’ve used a functional programming language, Scala won’t look much different because Scala supports both programming paradigms.

Scala is one of those rare languages that successfully integrates both object-oriented and functional language features. This makes it powerful because it gives you more in your toolbox to solve programming problems. If you have existing Java applications and are looking for a language that will improve your productivity and at the same time reuse your existing Java codebase, you’ll like Scala’s Java integration and the fact that Scala runs on the JVM platform.

It’s important, when learning something new, to become comfortable in the heretofore unknown environment. Chapter 2 stays within the middle of the road, helping you become comfortable with the basics of Scala and its environment so you can start working with it and writing Scala programs. Early on, the focus is on only the Scala interpreter and its REPL environment to keep things simple, but you’ll also learn about the basic Scala types, functions, for-comprehension, pattern matching, among other things.

Chapter 3 introduces the object-oriented features of Scala, including some not available in other statically typed languages.

You’ll build a Scala driver for MongoDB, a scalable document-oriented database. You’ll build this driver incrementally using the object-oriented constructs provided by Scala. You’ll explore how to use traits when building Scala applications, and learn about the importance of Scala case classes.

In chapter 4 you’ll learn Scala collections, which broadly support two categories of data structures—immutable and mutable.

To understand and benefit from Scala collections, you need to know two concepts: type parameterization and higher-order functions. Type parameterization allows you to create types that take another type as a parameter (similar to Java generics). Higher-order functions let you create functions that take other functions as parameters. These two concepts allow you to create generic and reusable components, like Scala collections.

The Scala collection is one of Scala’s most powerful features. The library implements all the common data structures you need, making it essential for every Scala developer. A recent addition to the collection library is parallel collections. Scala parallel collections allow you to solve data parallelism problems in Scala with ease.

Chapter 5, the end of part 1, focuses on functional programming, although you’ve been doing functional programming if you’ve been following the examples in the book. In some cases functional programming is obvious; other times it is mixed with object-oriented constructs of Scala. The chapter also touches on monads and practical examples.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset