Weidig Ben - A Functional Approach To Java. Augmenting Object-Oriented Java Code With Functional Principles.pdf

(5176 KB) Pobierz
A Functional Approach to Java
Augmenting Object-Oriented Code with Functional
Principles
Ben Weidig
A Functional Approach to Java
by Ben Weidig
Copyright © 2023 Benjamin Weidig. 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://oreilly.com). For more information, contact our
corporate/institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Acquisitions Editor: Brian Guerin
Development Editor: Rita Fernando
Production Editor: Ashley Stussy
Copyeditor: Liz Wheeler
Proofreader: Piper Editorial Consulting, LLC
Indexer: WordCo Indexing Services, Inc.
Interior Designer: David Futato
Cover Designer: Karen Montgomery
Illustrator: Kate Dullea
May 2023: First Edition
Revision History for the First Edition
2023-05-09: First Release
See
http://oreilly.com/catalog/errata.csp?isbn=9781098109929
for release
details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
A
Functional Approach to Java,
the cover image, and related trade dress are
trademarks of O’Reilly Media, Inc.
The views expressed in this work are those of the author, and do not
represent the publisher’s views. While the publisher and the author have
used good faith efforts to ensure that the information and instructions
contained in this work are accurate, the publisher and the author disclaim all
responsibility for errors or omissions, including without limitation
responsibility for damages resulting from the use of or reliance on this
work. Use of the information and instructions contained in this work is at
your own risk. If any code samples or other technology this work contains
or describes is subject to open source licenses or the intellectual property
rights of others, it is your responsibility to ensure that your use thereof
complies with such licenses and/or rights.
978-1-098-10992-9
[LSI]
Preface
A mind that is stretched by a new experience can never go back to its old
dimensions.
—Oliver Wendell Holmes, Jr.
Developing software is quite a complex endeavor. As Java developers, we
usually try to tame this complexity with object-oriented programming
(OOP) as a metaphor to represent the things we are developing, such as data
structures, and use a primarily imperative-focused coding style to handle
our program’s state. Although OOP is a well-known and battle-tested
approach to developing sensible software, not every problem is a good
match for it. We might introduce a certain amount of unnecessary
complexity by forcing OOP principles on every problem instead of using
more appropriate tools and paradigms also available to us. The functional
programming (FP) paradigm offers an alternative approach to solving
problems.
Functional programming isn’t a new idea. In fact, it’s even older than
object-oriented programming! It first appeared in the early years of
computing, in the 1950s, in the
Lisp
1
programming language and has been
used quite commonly in academia and niche fields. In recent years,
however, there has been an increasing interest in functional paradigms.
Many new functional languages have emerged, and non-functional
languages are including functional features to various degrees. The ideas
and concepts behind FP are now adopted in almost every mainstream
multiparadigm and general-purpose language, allowing us to use some form
of functional programming regardless of the context and chosen language.
Nothing stops us from taking the best parts of FP and augmenting our
existing way of programming and software development tools—and that’s
what this book is about!
Zgłoś jeśli naruszono regulamin