Book description
Interest in the Scala programming language continues to grow for many reasons. Scala embraces the functional programming style without abandoning the object-oriented paradigm, and it allows you to write programs more concisely than in Java. Because Scala runs on the JVM, it can access any Java library and is interoperable with familiar Java frameworks. Scala also makes it easier to leverage the full power of concurrency.
Written for experienced Java, C++, or C# programmers who are new to Scala or functional programming, Scala for the Impatient, Second Edition, introduces the key Scala concepts and techniques you need in order to be productive quickly. It is the perfect introduction to the language, particularly for impatient readers who want to learn the fundamentals of Scala so they can start coding quickly. It doesn’t attempt to exhaustively list all the features of the language or make you suffer through long and contrived examples. Instead, carefully crafted examples and hands-on activities guide you through well-defined stages of competency, from basic to expert.
This revised edition has been thoroughly updated for Scala 2.12 and reflects current Scala usage. It includes added coverage of recent Scala features, including string interpolation, dynamic invocation, implicit classes, and futures. Scala is a big language, but you can use it effectively without knowing all of its details intimately. This title provides precisely the information that you need to get started in compact, easy-to-understand chunks.
Get started quickly with Scala’s interpreter, syntax, tools, and unique idioms
Master core language features: functions, arrays, maps, tuples, packages, imports, exception handling, and more
Become familiar with object-oriented programming in Scala: classes, inheritance, and traits
Use Scala for real-world programming tasks: working with files, regular expressions, and XML
Work with higher-order functions and the powerful Scala collections library
Leverage Scala’s powerful pattern matching and case classes
Create concurrent programs with Scala futures
Implement domain-specific languages
Understand the Scala type system
Apply advanced “power tools,” such as annotations, implicits, and type classes
Register your product at informit.com/register for convenient access to downloads, updates, and corrections as they become available.
Table of contents
- About This E-Book
- Title Page
- Copyright Page
- Dedication Page
- Contents
- Foreword to the First Edition
- Preface
- About the Author
- Chapter 1. The Basics
- Chapter 2. Control Structures and Functions
- Chapter 3. Working with Arrays
- Chapter 4. Maps and Tuples
- Chapter 5. Classes
- Chapter 6. Objects
- Chapter 7. Packages and Imports
-
Chapter 8. Inheritance
- 8.1 Extending a Class
- 8.2 Overriding Methods
- 8.3 Type Checks and Casts
- 8.4 Protected Fields and Methods
- 8.5 Superclass Construction
- 8.6 Overriding Fields
- 8.7 Anonymous Subclasses
- 8.8 Abstract Classes
- 8.9 Abstract Fields
- 8.10 Construction Order and Early Definitions
- 8.11 The Scala Inheritance Hierarchy
- 8.12 Object Equality
- 8.13 Value Classes
- Exercises
- Chapter 9. Files and Regular Expressions
-
Chapter 10. Traits
- 10.1 Why No Multiple Inheritance?
- 10.2 Traits as Interfaces
- 10.3 Traits with Concrete Implementations
- 10.4 Objects with Traits
- 10.5 Layered Traits
- 10.6 Overriding Abstract Methods in Traits
- 10.7 Traits for Rich Interfaces
- 10.8 Concrete Fields in Traits
- 10.9 Abstract Fields in Traits
- 10.10 Trait Construction Order
- 10.11 Initializing Trait Fields
- 10.12 Traits Extending Classes
- 10.13 Self Types
- 10.14 What Happens under the Hood
- Exercises
- Chapter 11. Operators
- Chapter 12. Higher-Order Functions
-
Chapter 13. Collections
- 13.1 The Main Collections Traits
- 13.2 Mutable and Immutable Collections
- 13.3 Sequences
- 13.4 Lists
- 13.5 Sets
- 13.6 Operators for Adding or Removing Elements
- 13.7 Common Methods
- 13.8 Mapping a Function
- 13.9 Reducing, Folding, and Scanning
- 13.10 Zipping
- 13.11 Iterators
- 13.12 Streams
- 13.13 Lazy Views
- 13.14 Interoperability with Java Collections
- 13.15 Parallel Collections
- Exercises
-
Chapter 14. Pattern Matching and Case Classes
- 14.1 A Better Switch
- 14.2 Guards
- 14.3 Variables in Patterns
- 14.4 Type Patterns
- 14.5 Matching Arrays, Lists, and Tuples
- 14.6 Extractors
- 14.7 Patterns in Variable Declarations
- 14.8 Patterns in for Expressions
- 14.9 Case Classes
- 14.10 The copy Method and Named Parameters
- 14.11 Infix Notation in case Clauses
- 14.12 Matching Nested Structures
- 14.13 Are Case Classes Evil?
- 14.14 Sealed Classes
- 14.15 Simulating Enumerations
- 14.16 The Option Type
- 14.17 Partial Functions
- Exercises
- Chapter 15. Annotations
-
Chapter 16. XML Processing
- 16.1 XML Literals
- 16.2 XML Nodes
- 16.3 Element Attributes
- 16.4 Embedded Expressions
- 16.5 Expressions in Attributes
- 16.6 Uncommon Node Types
- 16.7 XPath-like Expressions
- 16.8 Pattern Matching
- 16.9 Modifying Elements and Attributes
- 16.10 Transforming XML
- 16.11 Loading and Saving
- 16.12 Namespaces
- Exercises
- Chapter 17. Futures
- Chapter 18. Type Parameters
-
Chapter 19. Advanced Types
- 19.1 Singleton Types
- 19.2 Type Projections
- 19.3 Paths
- 19.4 Type Aliases
- 19.5 Structural Types
- 19.6 Compound Types
- 19.7 Infix Types
- 19.8 Existential Types
- 19.9 The Scala Type System
- 19.10 Self Types
- 19.11 Dependency Injection
- 19.12 Abstract Types
- 19.13 Family Polymorphism
- 19.14 Higher-Kinded Types
- Exercises
-
Chapter 20. Parsing
- 20.1 Grammars
- 20.2 Combining Parser Operations
- 20.3 Transforming Parser Results
- 20.4 Discarding Tokens
- 20.5 Generating Parse Trees
- 20.6 Avoiding Left Recursion
- 20.7 More Combinators
- 20.8 Avoiding Backtracking
- 20.9 Packrat Parsers
- 20.10 What Exactly Are Parsers?
- 20.11 Regex Parsers
- 20.12 Token-Based Parsers
- 20.13 Error Handling
- Exercises
-
Chapter 21. Implicits
- 21.1 Implicit Conversions
- 21.2 Using Implicits for Enriching Existing Classes
- 21.3 Importing Implicits
- 21.4 Rules for Implicit Conversions
- 21.5 Implicit Parameters
- 21.6 Implicit Conversions with Implicit Parameters
- 21.7 Context Bounds
- 21.8 Type Classes
- 21.9 Evidence
- 21.10 The @implicitNotFound Annotation
- 21.11 CanBuildFrom Demystified
- Exercises
- Index
- Code Snippets
Product information
- Title: Scala for the Impatient, Second Edition
- Author(s):
- Release date: December 2016
- Publisher(s): Addison-Wesley Professional
- ISBN: 9780134540627
You might also like
book
Designing Data-Intensive Applications
Data is at the center of many challenges in system design today. Difficult issues need to …
book
Learning JavaScript Design Patterns, 2nd Edition
Do you want to write beautiful, structured, and maintainable JavaScript by applying modern design patterns to …
book
Modern Software Engineering: Doing What Works to Build Better Software Faster
Improve Your Creativity, Effectiveness, and Ultimately, Your Code In Modern Software Engineering, continuous delivery pioneer David …
book
Effective Java, 3rd Edition
Since this Jolt-award winning classic was last updated in 2008, the Java programming environment has changed …