Table of Contents

Copyright

Brief Table of Contents

Table of Contents

Foreword

Preface

Acknowledgments

About this Book

About the Cover Illustration

Chapter 1. Scala—a blended language

1.1. Functional programming meets object orientation

1.1.1. Discovering existing functional concepts

1.1.2. Examining functional concepts in Google Collections

1.2. Static typing and expressiveness

1.2.1. Changing sides

1.2.2. Type inference

1.2.3. Dropping verbose syntax

1.2.4. Implicits are an old concept

1.2.5. Using Scala’s implicit keyword

1.3. Transparently working with the JVM

1.3.1. Java in Scala

1.3.2. Scala in Java

1.3.3. The benefits of a JVM

1.4. Summary

Chapter 2. The core rules

2.1. Learn to use the Read Eval Print Loop (REPL)

2.1.1. Experiment-driven development

2.1.2. Working around eager parsing

2.1.3. Inexpressible language features

2.2. Think in expressions

2.2.1. Don’t use return

2.2.2. Mutability

2.3. Prefer immutability

2.3.1. Object equality

2.3.2. Concurrency

2.4. Use None instead of null

2.4.1. Advanced Option techniques

2.5. Polymorphic equality

2.5.1. Example: A timeline library

2.5.2. Polymorphic equals implementation

2.6. Summary

Chapter 3. Modicum of style—coding conventions

3.1. Avoid coding conventions from other languages

3.1.1. The block debacle

3.2. Dangling operators and parenthetical expressions

3.3. Use meaningful variable names

3.3.1. Avoid $ in names

3.3.2. Working with named and default parameters

3.4. Always mark overridden methods

3.5. Annotate for expected optimizations

3.5.1. Using the tableswitch optimization

3.5.2. Using the tail recursion optimization

3.6. Summary

Chapter 4. Utilizing object orientation

4.1. Limit code inside an object or trait’s body to initialization logic

4.1.1. Delayed construction

4.1.2. And then there’s multiple inheritance

4.2. Provide empty implementations for abstract methods on traits

4.3. Composition can include inheritance

4.3.1. Member composition by inheritance

4.3.2. Classic constructors with a twist

4.4. Promote abstract interface into its own trait

4.4.1. Interfaces you can talk to

4.4.2. Learning from the past

4.5. Provide return types in your public APIs

4.6. Summary

Chapter 5. Using implicits to write expressive code

5.1. Introduction to implicits

5.1.1. Identifiers: A digression

5.1.2. Scope and bindings

5.1.3. Implicit resolution

5.2. Enhancing existing classes with implicit views

5.3. Utilize implicit parameters with defaults

5.4. Limiting the scope of implicits

5.4.1. Creating implicits for import

5.4.2. Implicits without the import tax

5.5. Summary

Chapter 6. The Type System

6.1. Types

6.1.1. Types and paths

6.1.2. The type keyword

6.1.3. Structural types

6.2. Type constraints

6.3. Type parameters and higher-kinded types

6.3.1. Type parameter constraints

6.3.2. Higher-kinded types

6.4. Variance

6.4.1. Advanced variance annotations

6.5. Existential types

6.5.1. The formal syntax of existential types

6.6. Summary

Chapter 7. Using implicits and types together

7.1. Context bounds and view bounds

7.1.1. When to use implicit type constraints

7.2. Capturing types with implicits

7.2.1. Manifests

7.2.2. Using Manifests

7.2.3. Capturing type constraints

7.2.4. Specialized methods

7.3. Use type classes

7.3.1. FileLike as a type class

7.3.2. The benefits of type classes

7.4. Conditional execution using the type system

7.4.1. Heterogeneous typed list

7.4.2. IndexedView

7.5. Summary

Chapter 8. Using the right collection

8.1. Use the right collection

8.1.1. The collection hierarchy

8.1.2. Traversable

8.1.3. Iterable

8.1.4. Seq

8.1.5. LinearSeq

8.1.6. IndexedSeq

8.1.7. Set

8.1.8. Map

8.2. Immutable collections

8.2.1. Vector

8.2.2. List

8.2.3. Stream

8.3. Mutable collections

8.3.1. ArrayBuffer

8.3.2. Mixin mutation event publishing

8.3.3. Mixin synchronization

8.4. Changing evaluation with views and parallel collections

8.4.1. Views

8.4.2. Parallel collections

8.5. Writing methods to use with all collection types

8.5.1. Optimizing algorithms for each collections type

8.6. Summary

Chapter 9. Actors

9.1. Know when to use actors

9.1.1. Using actors to search

9.2. Use typed, transparent references

9.2.1. Scatter-Gather with OutputChannel

9.3. Limit failures to zones

9.3.1. Scatter-Gather failure zones

9.3.2. General failure handling practices

9.4. Limit overload using scheduler zones

9.4.1. Scheduling zones

9.5. Dynamic actor topology

9.6. Summary

Chapter 10. Integrating Scala with Java

10.1. The language mismatch between Scala and Java

10.1.1. Differences in primitive boxing

10.1.2. Differences in visibility

10.1.3. Inexpressible language features

10.2. Be wary of implicit conversions

10.2.1. Object identity and equality

10.2.2. Chaining implicits

10.3. Be wary of Java serialization

10.3.1. Serializing anonymous classes

10.4. Annotate your annotations

10.4.1. Annotation targets

10.4.2. Scala and static fields

10.5. Summary

Chapter 11. Patterns in functional programming

11.1. Category theory for computer science

11.2. Functors and monads, and how they relate to categories

11.2.1. Monads

11.3. Currying and applicative style

11.3.1. Currying

11.3.2. Applicative style

11.4. Monads as workflows

11.5. Summary

Index

List of Figures

List of Tables

List of Listings

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

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