functional_thinking.pdf
(
6639 KB
)
Pobierz
Functional Thinking
If you’re familiar with functional programming basics and want to gain a
much deeper understanding, this in-depth guide takes you beyond syntax
and demonstrates how you need to think in a new way. Software architect
Neal Ford shows intermediate to advanced developers how functional
coding allows you to step back a level of abstraction so you can see your
programming problem with greater clarity.
Each chapter shows you various examples of functional thinking, using
numerous code examples from Java 8 and other JVM languages that include
functional capabilities. This book may bend your mind, but you’ll come away
with a much better grasp of functional programming concepts.
■
This is a very important
“
book and I can’t imagine
anyone who is more
capable of writing it
than Neal.
President, Agile Developer, Inc.
—Venkat Subramaniam
”
Understand why many imperative languages are adding
functional capabilities
Compare functional and imperative solutions to common
problems
Examine ways to cede control of routine chores to the runtime
Learn how memoization and laziness eliminate hand-crafted
solutions
Explore functional approaches to design patterns and code
reuse
View real-world examples of functional thinking with Java 8,
and in functional architectures and web frameworks
Learn the pros and cons of living in a paradigmatically richer
world
■
■
■
■
■
■
If you’re new to functional programming, check out Josh Backfield’s book
Becoming Functional.
Neal Ford
is a director, architect, and meme wrangler at ThoughtWorks, a global
IT consultancy. Proficient in a variety of languages, his primary consulting focus
is the design, construction, and engineering practices of large-scale enterprise
applications.
SOF T WARE ENGINEERING
Twitter: @oreillymedia
facebook.com/oreilly
US $39.99
CAN $41.99
ISBN: 978-1-449-36551-6
Functional Thinking
Neal Ford
Functional Thinking
by Neal Ford
Copyright © 2014 Neal Ford. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Editors:
Mike Loukides and Meghan Blanchette
Production Editor:
Kristen Brown
Copyeditor:
Eileen Cohen
Proofreader:
Jasmine Kwityn
July 2014:
First Edition
Indexer:
Judith McConville
Cover Designer:
Karen Montgomery
Interior Designer:
David Futato
Illustrator:
Rebecca Demarest
Revision History for the First Edition:
2014-06-26:
First release
See
http://oreilly.com/catalog/errata.csp?isbn=9781449365516
for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc.
Functional Thinking,
the image of a thick-tailed greater galago, and related trade dress are
trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark
claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume no
responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-36551-6
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1. Why. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Shifting Paradigms
Aligning with Language Trends
Ceding Control to the Language/Runtime
Concision
2
4
4
5
2. Shift. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
A Common Example
Imperative Processing
Functional Processing
Case Study: Number Classification
Imperative Number Classification
Slightly More Functional Number Classification
Java 8 Number Classifier
Functional Java Number Classifier
Common Building Blocks
Filter
Map
Fold/Reduce
Synonym Suffering
Filter
Map
Fold/Reduce
Iteration to Higher-Order Functions
Closures
11
11
12
17
17
19
21
22
24
24
25
29
31
31
34
36
39
40
3. Cede. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
iii
Plik z chomika:
Leniek
Inne pliki z tego folderu:
clojure_cookbook.pdf
(9759 KB)
becoming_functional.pdf
(7143 KB)
clojure_programming.pdf
(10307 KB)
functional_javascript.pdf
(7547 KB)
functional_thinking.pdf
(6639 KB)
Inne foldery tego chomika:
advanced_ai_by_morgan_claypool
ai_and_machine_learning_toolkit_by_morgan_and_claypool_publishers
applied_math_and_statistics_toolkit_by_morgan_and_claypool
applied_math_productivity_by_mercury
applied_mathematics_by_mercury
Zgłoś jeśli
naruszono regulamin