Programming in Scala, Fourth Edition
Tags
Summary
The book opens with "a scalable language," explaining why Scala unites the object-oriented and functional paradigms, then uses "twelve steps to get started" to guide readers through hands-on familiarization with the interpreter, variables, functions, scripts, lists, tuples, sets, and maps. The main body systematically covers classes and objects, basic types and operations, functional objects, built-in control structures, functions and closures, control abstractions, composition and inheritance, traits, packages and imports, assertions and tests, case classes and pattern matching, lists and other collection classes, mutable objects, type parameterization, abstract members, implicit conversions and implicit parameters, and goes deeper into list implementation, revisiting for expressions, and the collections architecture.
Later chapters cover extractors, annotations, XML processing, modular programming with objects, object equality, Scala-Java interoperability, Futures and concurrent programming, and combinator parsing, concluding with a complete spreadsheet (SCells) case study. The most significant change in the fourth edition is a near-total rewrite of the collections framework in preparation for the transition to Scala 3, with substantial updates to collection inheritance hierarchies, implementations, methods, and views, expanding the book to nearly 850 pages. The book teaches not only "how to write" but also explains "why it is designed this way," helping readers understand the trade-offs behind language features. It is an indispensable reference for anyone seeking an in-depth study of Scala.
Editor's review
Who it's for
A good fit for
- 具备 Java 或其他面向对象语言基础,准备系统转向 Scala 的开发者
- 已在工作中使用 Scala,希望补齐类型系统、隐式与集合框架知识的中级工程师
- 需要理解函数式与面向对象融合范式,想从语言设计视角提升认知的程序员
- 大数据方向(Spark、Kafka 等生态)开发者,需要扎实掌握 Scala 语言本身的人
Not a good fit for
- 完全没有编程经验的零基础读者,书中假定读者熟悉面向对象基本概念
- 只想快速查语法、抄代码的读者,本书更偏系统讲解而非速查手册
- 只使用 Scala 3 且不愿阅读 2.13 语义细节的读者,部分内容与 Scala 3 已有差异
Reading tips
- 前 3 章务必边读边在 REPL 中敲示例,先把解释器、脚本和集合用法跑通再深入。
- 第 6、8、9、15、21 章是理解 Scala 思维的关键,建议放慢速度、配合习题手写代码。
- 第 22、24、25 章讲集合实现与架构,可在实际项目用到集合时再回读,效果更好。
- 把第 34 章 SCells 案例作为综合练习,独立复现一遍,检验对模式匹配与组合子解析的掌握。
About the publisher
The Publishing House of Electronics Industry is a comprehensive publisher distinguished by its focus on electronic information and related fields. Judging from the more than 3,000 titles in its catalogue, its publishing covers programming and design, artificial intelligence, computer science, finance and economics, photography, and social sciences, attending both to cutting-edge technology and to general readers. Representative titles include Factor Investing: Methods and Practice, x86 Assembly Language: From Real Mode to Protected Mode, The RISC-V Reader, Artificial Intelligence: Speech Recognition, Understanding and Practice, Phased Array Radar Technology, Radar Target Characteristics, and 100 Go Mistakes and How to Avoid Them, most of which centre on technical methods and engineering practice. Its authors include Shi Chuan, Li Zhong, Wang Xiaobo, David Patterson, Andrew Waterman, and Yu Zihao, among others from China and abroad. Owing to limited public information, no further publishing features are elaborated here.
Contents
- Preface
- Acknowledgments
- Introduction
- Chapter 1 A Scalable Language
- Chapter 2 First Steps in Scala
- Chapter 3 Next Steps in Scala
- Chapter 4 Classes and Objects
- Chapter 5 Basic Types and Operations
- Chapter 6 Functional Objects
- Chapter 7 Built-in Control Structures
- Chapter 8 Functions and Closures
- Chapter 9 Control Abstraction
- Chapter 10 Composition and Inheritance
- Chapter 11 Scala's Hierarchy
- Chapter 12 Traits
- Chapter 13 Packages and Imports
- Chapter 14 Assertions and Tests
- Chapter 15 Case Classes and Pattern Matching
- Chapter 16 Working with Lists
- Chapter 17 Working with Other Collections
- Chapter 18 Mutable Objects
- Chapter 19 Type Parameterization
- Chapter 20 Abstract Members
- Chapter 21 Implicit Conversions and Parameters
- Chapter 22 Implementing Lists
- Chapter 23 For Expressions Revisited
- Chapter 24 Collections in Depth
- Chapter 25 The Architecture of Scala Collections
- Chapter 26 Extractors
- Chapter 27 Annotations
- Chapter 28 Working with XML
- Chapter 29 Modular Programming Using Objects
- Chapter 30 Object Equality
- Chapter 31 Combining Scala and Java
- Chapter 32 Futures and Concurrency
- Chapter 33 Combinator Parsing
- Chapter 34 The SCells Spreadsheet
- Appendix Scala Scripts on Unix and Windows
- Glossary
- About the Authors
FAQ
这本书适合完全没有编程基础的人吗?
第4版和第3版的主要区别是什么?
这本书讲的是 Scala 2 还是 Scala 3?
一定要按顺序从头读到尾吗?
Comments
Find this book
This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.