Copyright
Brief Table of Contents
Table of Contents
Foreword
Preface
Acknowledgments
About this Book
About the Cover Illustration
1. Scala: the basics
Chapter 1. Why Scala?
1.1. What’s Scala?
1.1.1. Scala as an object-oriented language
1.1.2. Scala as a functional language
1.1.3. Scala as a multi-paradigm language
1.1.4. Scala as a scalable and extensible language
1.1.5. Scala runs on the JVM
1.2. The current crisis
1.2.1. End of Moore’s law
1.2.2. Programming for multicores
1.3. Transitioning from Java to Scala
1.3.1. Scala improves productivity
1.3.2. Scala does more with less code
1.4. Coming from a dynamic language
1.4.1. Case for static typing, the right way
1.5. For the programming language enthusiast
1.6. Summary
Chapter 2. Getting started
2.1. REPL with Scala interpreter
2.2. Scala basics
2.2.1. Basic types
2.2.2. Defining variables
2.2.3. Defining functions
2.3. Working with Array and List
2.4. Controlling flow with loops and ifs
2.5. For-comprehensions
2.6. Pattern matching
2.7. Exception handling
2.8. Command-line REST client: building a working example
2.8.1. Introducing HttpClient library
2.8.2. Building the client, step by step
2.9. Summary
Chapter 3. OOP in Scala
3.1. Building a Scala MongoDB driver: user stories
3.2. Classes and constructors
3.3. Packaging
3.4. Scala imports
3.5. Objects and companion objects