Programming in Scala, Third Edition

Martin Odersky

出版社

Artima Press

出版时间

2016-05-10

ISBN

9780981531687

评分

★★★★★
书籍介绍

This third edition brings the entire book, up to date, adding new material to cover features appearing in Scala versions 2.9 through Scala 2.12, including:

String interpolation

Functional Futures

Implicit classes

Defining new AnyVals

Typeclasses and context bounds

The latest style recommendations

SAM support in Scala 2.12

Martin Odersky is the creator of the Scala language. He is a professor at EPFL in Lausanne, Switzerland, and a founder of Typesafe, Inc. He works on programming languages and systems, more specifically on the topic of how to combine object-oriented and functional programming. Since 2001 he has concentrated on designing, implementing, and refining Scala. Previously, he has influ...

(展开全部)

AI导读
核心看点
  • 本书由Scala语言创始人Martin Odersky亲自执笔,是学习Scala最权威、最详尽的官方指南。内容覆盖Scala 2.9至2.12版本的所有特性,包括字符串插值、函数式Future、隐式类、类型类等,确保读者掌握最新且规范的语言用法。
  • 书中深入剖析Scala的设计哲学与底层原理,解释为何如此设计,帮助读者理解语言特性背后的统一性与自洽性。从基础语法到高级特性如模式匹配、集合操作、并发编程等,均提供透彻讲解与最佳实践指导。
  • 作为一本系统性教材,本书逻辑清晰、层层递进,适合希望深入理解Scala内核机制的开发者。书中不仅教授语法,更强调如何写出高效、安全、符合函数式编程范式的代码,提升工程化能力与代码质量。
适合谁读
  • 希望系统学习Scala语言、掌握其全部特性与最佳实践的程序员,尤其是已有Java、C++或C#等命令式语言背景,想转向函数式编程或大数据处理领域的开发者。
  • 正在使用Spark、Akka等基于Scala构建的大数据或并发框架,但缺乏Scala语言基础,需要补强语言知识以提升开发效率与代码安全性的工程师。
  • 对函数式编程概念感兴趣,希望了解Scala如何在保持强大表达力的同时维持类型安全与一致性,并寻求权威参考资料以纠正错误认知的学习者。
读前提醒
  • 本书内容极为详尽,不适合零基础速成。建议先通过其他简易教程了解Scala基本语法后,再以此书作为深入学习的参考手册,避免被复杂特性劝退。
  • 书中部分高级特性如隐式转换、类型类等在工程实践中需谨慎使用,读者应结合社区最佳实践判断何时使用,避免过度设计导致代码难以维护。
  • Scala版本迭代较快,本书仅覆盖至2.12,若需学习Scala 3或最新特性,请配合官方文档或其他新版资料,注意区分版本差异。
读者共识
  • 读者普遍认为本书是学习Scala最权威、最全面的资料,由语言创始人撰写,内容准确无误,解释透彻,是纠正错误认知、深入理解语言设计的唯一可靠来源。
  • 尽管部分读者反映内容过于复杂、学习曲线陡峭,但多数认可其系统性价值,认为读完能显著提升代码质量与工程能力,尤其适合希望写出高质量Scala代码的开发者。
  • 有读者指出书中未涵盖Akka等生态内容,且部分语法已过时,但依然肯定其作为语言规范参考的核心地位,建议配合其他资源学习最新实践。

本导读基于书籍简介、目录、原文摘录、短评和书评生成,不等同于全文精读。

精彩摘录
  • "About the Authors Martin Odersky is the creator of the Scala language. He is a professor at EPFL in Lausanne, Switzerland, and a founder of Scala Solutions Inc. He works on programming languages and systems, more specifically on the topic of how to combine object-oriented and functional programming."
  • "scala> implicit def intToRational(x: Int) = new Rational(x)"
  • "You have now seen one major use of traits: turning a thin interface into a rich one. Now we’ll turn to a second major use: providing stackable modifi- cations to classes. Traits let you modify the methods of a class, and they do so in a way that allows you to stack those modifications with each othe"
  • "If you’re coming from an imperative background, such as Java, C++, or C#, you may think of var as a regular variable and val as a special kind of variable. On the other hand, if you’re coming from a functional background, such as Haskell, OCaml, or Erlang, you might think of val as a regular vari- a"
  • "(Java 中)当 finally 子句包含一个显式的返回语句,或者抛出某个异常,那么这个返回值或异常将会改写(overrule)任何在之前的 try 代码块或某个 catch 子句中产生的值。"
  • "一般来说,Scala 只有两个命名空间用于定义,不同于 Java 的四个。Java 的四个命名空间分别是:字段、方法、类型和包,而 Scala 的两个命名空间分别是:值(字段、方法、包和单例对象)、类型(类和特质名)。"
作者简介
Martin Odersky is the creator of the Scala language. He is a professor at EPFL in Lausanne, Switzerland, and a founder of Typesafe, Inc. He works on programming languages and systems, more specifically on the topic of how to combine object-oriented and functional programming. Since 2001 he has concentrated on designing, implementing, and refining Scala. Previously, he has influenced the development of Java as a co-designer of Java generics and as the original author of the current javac reference compiler. He is a fellow of the ACM. Lex Spoon is a software engineer at Semmle, Ltd. He worked on Scala for two years as a post-doc at EPFL. He has a Ph.D. from Georgia Tech, where he worked on static analysis of dynamic languages. In addition to Scala, he has helped develop a wide variety of programming languages, including the dynamic language Smalltalk, the scientific language X10, and the logic language that powers Semmle. He and his wife live in Atlanta with two cats and a chihuahua. Bill Venners is president of Artima, Inc., publisher of the Artima Developer website (www.artima.com), and cofounder of Escalate Software, LLC. He is author of the book, Inside the Java Virtual Machine, a programmer-oriented survey of the Java platform's architecture and internals. His popular columns in JavaWorld magazine covered Java internals, object-oriented design, and Jini. Active in the Jini Community since its inception, Bill led the Jini Community's ServiceUI project, whose ServiceUI API became the de facto standard way to associate user interfaces to Jini services. Bill is also the lead developer and designer of the ScalaTest testing framework and the Scalactic library for functional, object-oriented programming. testing tool for Scala and Java developers.
目录
What Readers are Saying ii
Contents xiii
List of Figures xxiii
List of Tables xxv
List of Listings xxvii

显示全部
用户评论
因为个人 Spark 的使用场景较多, 前段时间用 Scala 实现了一个数据处理的程序, 发现代码的确简洁不少, 写起来也很 easy -- 只是实现功能并没有传说中的那么难. 因此系统性地学习下这么语言.作者是 Scala 的创建者之一, 书中阐述了一些特性和设计的原有, 也对函数式编程中的一些概念做了详尽的解释. 读完之后, 觉得没有必要读其他 Scala 的书籍.
读过,读不下去,这玩意工程化很差
无语了,Scala的复杂性还是比我预期的还要复杂。特性虽然可以一一列举出来,但是还可以这样组合。这本还比较中规中矩,没有涉及很灵活的用法。本来以为 case class 一般是作为聚合或者ADT,结果表达能力超过了我以前认知的ADT。本来以为模版不会像C++一样复杂,结果泛型约束比Rust还多,这点可能是因为类型擦除导致的很灵活的类型转换,Scala类库都是满屏的泛型参数。本来以为隐式转换和隐式参数是为了API更灵活,可是好多类库都大量使用,导致API调用的都很晕,不过写DSL是真的方便。最后是语法糖,特别多,不全部熟悉的话根本看不懂别人的代码,而有些糖一点也不甜,也不符合人体工学。这本书虽然也不深,但是也足够难倒我了。
FP
Scala lang二刷,历时一个月多,很细致的语言Manual,从设计者的角度,系统地解答诸多对语言本身的困惑. It's time for Play & hakking!
我水平不够,看起来有点迷
期待下一版
虽然大多浅尝辄止,但是覆盖面很全,想讲的重点基本都讲清楚了。
(读第四版去了……
收藏