万本电子书0元读

万本电子书0元读

顶部广告

Learning Scala Programming电子书

售       价:¥

3人正在读 | 0人评论 9.8

作       者:Vikash Sharma

出  版  社:Packt Publishing

出版时间:2018-01-30

字       数:54.3万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Learn how to write scalable and concurrent programs in Scala, a language that grows with you. About This Book ? Get a grip on the functional features of the Scala programming language ? Understand and develop optimal applications using object-oriented and functional Scala constructs ? Learn reactive principles with Scala and work with the Akka framework Who This Book Is For This book is for programmers who choose to get a grip over Scala to write concurrent, scalable, and reactive programs. No prior experience with any programming language is required to learn the concepts explained in this book. Knowledge of any programming language would help the reader understanding concepts faster though. What You Will Learn ? Get to know the reasons for choosing Scala: its use and the advantages it provides over other languages ? Bring together functional and object-oriented programming constructs to make a manageable application ? Master basic to advanced Scala constructs ? Test your applications using advanced testing methodologies such as TDD ? Select preferred language constructs from the wide variety of constructs provided by Scala ? Make the transition from the object-oriented paradigm to the functional programming paradigm ? Write clean, concise, and powerful code with a functional mindset ? Create concurrent, scalable, and reactive applications utilizing the advantages of Scala In Detail Scala is a general-purpose programming language that supports both functional and object-oriented programming paradigms. Due to its concise design and versatility, Scala's applications have been extended to a wide variety of fields such as data science and cluster computing. You will learn to write highly scalable, concurrent, and testable programs to meet everyday software requirements. We will begin by understanding the language basics, syntax, core data types, literals, variables, and more. From here you will be introduced to data structures with Scala and you will learn to work with higher-order functions. Scala's powerful collections framework will help you get the best out of immutable data structures and utilize them effectively. You will then be introduced to concepts such as pattern matching, case classes, and functional programming features. From here, you will learn to work with Scala's object-oriented features. Going forward, you will learn about asynchronous and reactive programming with Scala, where you will be introduced to the Akka framework. Finally, you will learn the interoperability of Scala and Java. After reading this book, you'll be well versed with this language and its features, and you will be able to write scalable, concurrent, and reactive programs in Scala. Style and approach This book is for programmers who want to master Scala to write concurrent, scalable, and reactive programs. Though no experience with any programming language is needed, some basic knowledge would help understand concepts faster.
目录展开

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

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部