售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Title Page
Title Page
Copyright and Credits
Copyright and Credits
Learning Scala Programming
Learning Scala Programming
Packt Upsell
Packt Upsell
Why subscribe?
Why subscribe?
PacktPub.com
PacktPub.com
Contributors
Contributors
About the author
About the author
About the reviewer
About the reviewer
Packt is searching for authors like you
Packt is searching for authors like you
Preface
Preface
Who this book is for
Who this book is for
What this book covers
What this book covers
To get the most out of this book
To get the most out of this book
Download the example code files
Download the example code files
Conventions used
Conventions used
Get in touch
Get in touch
Reviews
Reviews
Getting Started with Scala Programming
Getting Started with Scala Programming
Introduction to Scala
Introduction to Scala
A programming paradigm
A programming paradigm
Object-oriented versus functional paradigms
Object-oriented versus functional paradigms
Scala is multi-paradigm
Scala is multi-paradigm
Scala advantages
Scala advantages
Runs on JVM
Runs on JVM
Super smart syntax
Super smart syntax
Best of both worlds
Best of both worlds
Type is the core
Type is the core
Concurrency made easy
Concurrency made easy
Asynchronous code
Asynchronous code
Asynchronous versus parallel versus concurrent programming
Asynchronous versus parallel versus concurrent programming
Now available for the frontend
Now available for the frontend
Smart IDEs
Smart IDEs
Extensive language
Extensive language
Online support
Online support
Working with Scala
Working with Scala
Java installation
Java installation
SBT installation
SBT installation
Scala REPL
Scala REPL
Scala IDEs
Scala IDEs
Running our first program
Running our first program
Summary
Summary
Building Blocks of Scala
Building Blocks of Scala
What is underneath a Scala program?
What is underneath a Scala program?
Vals and vars
Vals and vars
Literals
Literals
Integer literals
Integer literals
Floating point literals
Floating point literals
Boolean literals
Boolean literals
Character literals
Character literals
String literals
String literals
Symbol literals
Symbol literals
Tuple literals
Tuple literals
Function literals
Function literals
Data types
Data types
Scala's class hierarchy
Scala's class hierarchy
Any
Any
AnyVal and AnyRef
AnyVal and AnyRef
AnyRef
AnyRef
AnyVal
AnyVal
Unit
Unit
Boolean
Boolean
Null and Nothing
Null and Nothing
Type inference
Type inference
Operators in Scala
Operators in Scala
Arithmetic operators
Arithmetic operators
Relational operators
Relational operators
Logical operators
Logical operators
Bitwise operators
Bitwise operators
Operator precedence
Operator precedence
Wrapper classes
Wrapper classes
String Interpolators
String Interpolators
The s interpolator
The s interpolator
f Interpolator
f Interpolator
The raw interpolator
The raw interpolator
Summary
Summary
Shaping our Scala Program
Shaping our Scala Program
Looping
Looping
The for loop
The for loop
The while Loop
The while Loop
The do while loop
The do while loop
The for expressions
The for expressions
The for yield expressions
The for yield expressions
Recursion
Recursion
Why recursion over iteration?
Why recursion over iteration?
Limitations of recursion
Limitations of recursion
The ideal way to write recursive functions
The ideal way to write recursive functions
Conditional statements
Conditional statements
The if else conditional expression
The if else conditional expression
Pattern matching
Pattern matching
Summary
Summary
Giving Meaning to Programs with Functions
Giving Meaning to Programs with Functions
Function syntax
Function syntax
Nesting of functions
Nesting of functions
Calling a function
Calling a function
Passing a variable number of arguments
Passing a variable number of arguments
Calling a function with a default parameter value
Calling a function with a default parameter value
Calling a function while passing named arguments
Calling a function while passing named arguments
Function literals
Function literals
Evaluation strategies
Evaluation strategies
Call by name
Call by name
Call by value
Call by value
Partial functions
Partial functions
Summary
Summary
Getting Familiar with Scala Collections
Getting Familiar with Scala Collections
Motivation
Motivation
Immutable and mutable collections
Immutable and mutable collections
Differences between the root and immutable collections
Differences between the root and immutable collections
Hierarchy of collections in Scala
Hierarchy of collections in Scala
Traversable
Traversable
Iterable
Iterable
Seq
Seq
Sequences
Sequences
Map
Map
Set
Set
Commonly used collections in Scala
Commonly used collections in Scala
List
List
Map
Map
SortedSet
SortedSet
Streams
Streams
Vector
Vector
Immutable stack
Immutable stack
Immutable queue
Immutable queue
Ranges
Ranges
ArrayBuffer
ArrayBuffer
ListBuffer
ListBuffer
StringBuilder
StringBuilder
Array
Array
Rich operations performed on collections
Rich operations performed on collections
Parallel collections in Scala
Parallel collections in Scala
ParArray
ParArray
ParVector
ParVector
Converting a Java collection into a Scala collection
Converting a Java collection into a Scala collection
Choosing a collection
Choosing a collection
Collection performance
Collection performance
Summary
Summary
Object-Oriented Scala Basics
Object-Oriented Scala Basics
Classes
Classes
Abstract classes
Abstract classes
Abstract classes and traits
Abstract classes and traits
The final classes
The final classes
Objects as singletons
Objects as singletons
Companion objects
Companion objects
Case classes
Case classes
Summary
Summary
Next Steps in Object-Oriented Scala
Next Steps in Object-Oriented Scala
Composition and inheritance
Composition and inheritance
Class inheritance
Class inheritance
Extending classes
Extending classes
Subtyping versus subclassing
Subtyping versus subclassing
Overriding data and behavior
Overriding data and behavior
Restricting inheritance – final keyword
Restricting inheritance – final keyword
Dynamic binding in function invocation
Dynamic binding in function invocation
Misusing inheritance
Misusing inheritance
Default and parameterized constructors
Default and parameterized constructors
Traits
Traits
Traits as mix-ins
Traits as mix-ins
Traits as composable mix-ins
Traits as composable mix-ins
Traits as stackable modifications
Traits as stackable modifications
Linearization
Linearization
Packaging and importing
Packaging and importing
Package statements
Package statements
Multiple package statements in a file
Multiple package statements in a file
Nested package statements
Nested package statements
Chaining package statements
Chaining package statements
Importing packages
Importing packages
Visibility rules
Visibility rules
Sealed traits
Sealed traits
Summary
Summary
More on Functions
More on Functions
Function literals
Function literals
Methods
Methods
Functions versus methods
Functions versus methods
Methods or functions?
Methods or functions?
What are closures?
What are closures?
Higher-order functions
Higher-order functions
Currying
Currying
Converting a function with multiple parameters to curried form
Converting a function with multiple parameters to curried form
Partially applied functions
Partially applied functions
Summary
Summary
Using Powerful Functional Constructs
Using Powerful Functional Constructs
For expressions
For expressions
Pattern matching
Pattern matching
Different ways we can pattern match
Different ways we can pattern match
Matching a variable
Matching a variable
Matching a constant
Matching a constant
Matching a constructor
Matching a constructor
Option type
Option type
Lazy declaration
Lazy declaration
Tail call optimization
Tail call optimization
Combinators
Combinators
Type parameterization
Type parameterization
Summary
Summary
Advanced Functional Programming
Advanced Functional Programming
Why so serious about types?
Why so serious about types?
Here comes type parameterization
Here comes type parameterization
Another way around - generic classes and traits
Another way around - generic classes and traits
Type parameter names
Type parameter names
Container types
Container types
Type erasure
Type erasure
Variance under inheritance
Variance under inheritance
When to use what type of variance relation
When to use what type of variance relation
Abstract types
Abstract types
Type bounds
Type bounds
Abstract versus parameterized types
Abstract versus parameterized types
Type-classes
Type-classes
Summary
Summary
Working with Implicits and Exceptions
Working with Implicits and Exceptions
Exception handling – the old way
Exception handling – the old way
Using the Option way
Using the Option way
Either left or right
Either left or right
Implicits - what and why
Implicits - what and why
Implicit parameters
Implicit parameters
The implicitly method
The implicitly method
Implicit conversions
Implicit conversions
Looking for implicits
Looking for implicits
Type-classes ahead!
Type-classes ahead!
Summary
Summary
Introduction to Akka
Introduction to Akka
Why do we care about Akka?
Why do we care about Akka?
What's up with the Actor Model?
What's up with the Actor Model?
Understanding the Actor system
Understanding the Actor system
Props
Props
Actor references and paths
Actor references and paths
Selecting existing actorRefs via actorSelection
Selecting existing actorRefs via actorSelection
How the Actor life cycle works
How the Actor life cycle works
Hello world in Akka
Hello world in Akka
Setting up the environment
Setting up the environment
Writing our first Actor
Writing our first Actor
The tell versus ask versus forward method
The tell versus ask versus forward method
Stopping Actors
Stopping Actors
The preStart and postStop hooks
The preStart and postStop hooks
Actor communication via messages and its semantics
Actor communication via messages and its semantics
Supervising fault in our actors
Supervising fault in our actors
OneForOne versus AllForOne strategy
OneForOne versus AllForOne strategy
Default supervision strategy
Default supervision strategy
Applying the supervision strategy
Applying the supervision strategy
Testing actors
Testing actors
Summary
Summary
Concurrent Programming in Scala
Concurrent Programming in Scala
Concurrent programming
Concurrent programming
Building blocks of concurrency
Building blocks of concurrency
Understanding processes and threads
Understanding processes and threads
Locks and synchronization
Locks and synchronization
Executor and ExecutionContext
Executor and ExecutionContext
Asynchronous programming
Asynchronous programming
Working with Futures
Working with Futures
What if Future computations go wrong?
What if Future computations go wrong?
Why not compose two or more Futures?
Why not compose two or more Futures?
Working with Promises
Working with Promises
Parallel collections
Parallel collections
Summary
Summary
Programming with Reactive Extensions
Programming with Reactive Extensions
Reactive programming
Reactive programming
Reactive extensions
Reactive extensions
React to RxScala
React to RxScala
Creating Observables
Creating Observables
Summary
Summary
Testing in Scala
Testing in Scala
The why and what of TDD
The why and what of TDD
The process of TDD
The process of TDD
Step 1 - write a test that will fail
Step 1 - write a test that will fail
Step 2 - write code to pass the failing test
Step 2 - write code to pass the failing test
Step 3 - refactor the code to improve the quality
Step 3 - refactor the code to improve the quality
Step 4 - repeat steps 1 to 3
Step 4 - repeat steps 1 to 3
Scenario
Scenario
Behavior driven development (BDD)
Behavior driven development (BDD)
ScalaTest
ScalaTest
Setting up for testing
Setting up for testing
Testing in style using ScalaTest
Testing in style using ScalaTest
Assertions
Assertions
Matchers
Matchers
ScalaMock – a native library to mock objects
ScalaMock – a native library to mock objects
Summary
Summary
Other Books You May Enjoy
Other Books You May Enjoy
Leave a review - let other readers know what you think
Leave a review - let other readers know what you think
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜