Functional Programming Patterns in Scala and Clojure: Write Lean Programs for the JVM (Paperback)

Michael Bevilacqua-Linn

買這商品的人也買了...

商品描述

Solve real-life programming problems with a fraction of the code that pure object-oriented programming requires. Use Scala and Clojure to solve in-depth problems with two sets of patterns: object-oriented patterns that become more concise with functional programming, and natively functional patterns. Your code will be more declarative, with fewer bugs and lower maintenance costs.

Functional languages have their own patterns that enable you to solve problems with less code than object-oriented programming alone. This book introduces you, the experienced Java programmer, to Scala and Clojure: practical, production-quality languages that run on the JVM and interoperate with existing Java. By using both the statically typed, type-inferred Scala and the dynamically typed, modern Lisp Clojure, you'll gain a broad understanding of functional programming.

For each pattern, you'll first see the traditional object-oriented solution, and then dig into the functional replacements in both Scala and Clojure. These patterns are common in the functional world and deserve to become part of your problem-solving toolkit. On the object-oriented side, you'll see many common patterns, such as Command, Strategy, and Null Object. On the functional side, you'll learn core functional patterns such as Memoization, Lazy Sequence, and Tail Recursion.

Each pattern helps you solve a common programming problem. Working through them gives you a set of patterns you can use to solve problems you come across while writing programs. Finally, you'll learn how to work your existing Java code into new Scala or Clojure projects. You can start off small, adding functional code little by little, so you can complement your existing knowledge with Scala and Clojure as these languages gain popularity on the JVM.

What You Need

Clojure 1.5 and Scala 2.10.Optionally, Eclipse with plugins.

商品描述(中文翻譯)

以更少的程式碼解決真實生活中的程式設計問題,使用Scala和Clojure來解決深入的問題,這兩種模式包括:隨著函數式程式設計變得更簡潔的物件導向模式,以及本地函數式模式。您的程式碼將更具聲明性,錯誤更少,維護成本更低。

函數式語言具有自己的模式,使您能夠使用比單純的物件導向程式設計更少的程式碼來解決問題。本書將向您介紹Scala和Clojure:這兩種實用的、適用於生產環境的語言運行在JVM上,並與現有的Java程式碼互通。通過同時使用靜態類型、類型推斷的Scala和動態類型、現代Lisp的Clojure,您將獲得對函數式程式設計的廣泛理解。

對於每個模式,您將首先看到傳統的物件導向解決方案,然後深入研究Scala和Clojure中的函數式替代方案。這些模式在函數式世界中很常見,值得成為您解決問題的工具箱的一部分。在物件導向方面,您將看到許多常見的模式,例如Command、Strategy和Null Object。在函數式方面,您將學習核心函數式模式,例如Memoization、Lazy Sequence和Tail Recursion。

每個模式都幫助您解決常見的程式設計問題。通過這些模式的應用,您將獲得一組可以用來解決撰寫程式時遇到的問題的模式。最後,您將學習如何將現有的Java程式碼整合到新的Scala或Clojure項目中。您可以從小處著手,逐漸添加函數式程式碼,以便在這些語言在JVM上變得流行時,能夠補充您現有的知識。

您需要的工具:
- Clojure 1.5和Scala 2.10。
- 可選的Eclipse和插件。