Book description
Get up to speed on Scala, the JVM language that offers all the benefits of a modern object model, functional programming, and an advanced type system. Packed with code examples, this comprehensive book shows you how to be productive with the language and ecosystem right away, and explains why Scala is ideal for today's highly scalable, data-centric applications that support concurrency and distribution. This second edition covers recent language features, with new chapters on pattern matching, comprehensions, and advanced functional programming.
Publisher resources
Table of contents
- Foreword
- Preface
- 1. Zero to Sixty: Introducing Scala
-
2. Type Less, Do More
- Semicolons
- Variable Declarations
- Ranges
- Partial Functions
- Method Declarations
- Inferring Type Information
- Reserved Words
- Literal Values
- Option, Some, and None: Avoiding nulls
- Sealed Class Hierarchies
- Organizing Code in Files and Namespaces
- Importing Types and Their Members
- Abstract Types Versus Parameterized Types
- Recap and What’s Next
-
3. Rounding Out the Basics
- Operator Overloading?
- Methods with Empty Argument Lists
- Precedence Rules
- Domain-Specific Languages
- Scala if Statements
- Scala for Comprehensions
- Other Looping Constructs
- Conditional Operators
- Using try, catch, and finally Clauses
- Call by Name, Call by Value
- lazy val
- Enumerations
- Interpolated Strings
- Traits: Interfaces and “Mixins” in Scala
- Recap and What’s Next
-
4. Pattern Matching
- A Simple Match
- Values, Variables, and Types in Matches
- Matching on Sequences
- Matching on Tuples
- Guards in case Clauses
- Matching on case Classes
- Matching on Variable Argument Lists
- Matching on Regular Expressions
- More on Binding Variables in case Clauses
- More on Type Matching
- Sealed Hierarchies and Exhaustive Matches
- Other Uses of Pattern Matching
- Concluding Remarks on Pattern Matching
- Recap and What’s Next
- 5. Implicits
-
6. Functional Programming in Scala
- What Is Functional Programming?
- Functional Programming in Scala
- Recursion
- Tail Calls and Tail-Call Optimization
- Partially Applied Functions Versus Partial Functions
- Currying and Other Transformations on Functions
- Functional Data Structures
- Traversing, Mapping, Filtering, Folding, and Reducing
- Left Versus Right Traversals
- Combinators: Software’s Best Component Abstractions
- What About Making Copies?
- Recap and What’s Next
- 7. for Comprehensions in Depth
- 8. Object-Oriented Programming in Scala
- 9. Traits
- 10. The Scala Object System, Part I
- 11. The Scala Object System, Part II
- 12. The Scala Collections Library
- 13. Visibility Rules
- 14. Scala’s Type System, Part I
- 15. Scala’s Type System, Part II
- 16. Advanced Functional Programming
- 17. Tools for Concurrency
- 18. Scala for Big Data
- 19. Dynamic Invocation in Scala
- 20. Domain-Specific Languages in Scala
- 21. Scala Tools and Libraries
- 22. Java Interoperability
- 23. Application Design
- 24. Metaprogramming: Macros and Reflection
- A. References
- Index
Product information
- Title: Programming Scala, 2nd Edition
- Author(s):
- Release date: December 2014
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781491949856
You might also like
book
Programming Scala, 3rd Edition
Get up to speed on Scala--the JVM, JavaScript, and natively compiled language that offers all the …
book
Scala Cookbook, 2nd Edition
Save time and trouble building object-oriented, functional, and concurrent applications with Scala. The latest edition of …
book
Scala for the Impatient, 3rd Edition
Scala 3--A Clear, Concise Guide Scala 3 is concise, consistent, flexible, robust, and efficient, but there's …
book
The Go Programming Language
is the authoritative resource for any programmer who wants to learn Go. It shows how to …