Functional Design: Principles, Patterns, and Practices

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

A Practical Guide to Better, Cleaner Code with Functional Programming In Functional Design, renowned software engineer Robert C. Martin ("Uncle Bob") explains how and why to use functional programming to build better systems for real customers. Martin compares conventional object-oriented coding structures in Java to those enabled by functional languages, identifies the best roles for each, and shows how to build better systems by judiciously using them in context. Martin's approach is pragmatic, minimizing theory in favor of "in the-trenches" problem-solving. Through accessible examples, working developers will discover how the easy-to-learn, semantically rich Clojure language can help them improve code cleanliness, design, discipline, and outcomes. Martin examines well-known SOLID principles and Gang of Four Design Patterns from a functional perspective, revealing why patterns remain extremely valuable to functional programmers, and how to use them to achieve superior results. • Understand functional basics: immutability, persistent data, recursion, iteration, laziness, and statefulness • Contrast functional and object approaches through expertly crafted case studies • Explore functional design techniques for data flow • Use classic SOLID principles to write better Clojure code • Master pragmatic approaches to functional testing, GUIs, and concurrency • Make the most of design patterns in functional environments • Walk through building an enterprise-class Clojure application "Functional Design exudes 'classic-on-arrival'. Bob pulls back the curtain to reveal how functional programming elements make software design simple yet pragmatic. He does so without alienating experienced object-oriented programmers coming from languages like C#, C++, or Java." --Janet A. Carr, Independent Clojure Consultant

Author(s): Robert C. Martin
Series: Robert C. Martin Series
Edition: 1
Publisher: Addison-Wesley Professional
Year: 2023

Language: English
Commentary: Publisher's PDF
Pages: 374
City: Boston, MA
Tags: GUI; Concurrency; Functional Programming; Design Patterns; Laziness; Object-Oriented Programming; Recursion; SOLID; Clojure; Testing; Data Persistence; Functional Design

Cover
Half Title
Contents
Title Page
Copyright Page
Foreword
Preface
Acknowledgments
About the Author
PART I: Functional Basics
Chapter 1 Immutability
What Is Functional Programming?
The Problem with Assignment
So Why Is It Called Functional?
No Change of State?
Immutability
Chapter 2 Persistent Data
On Cheating
Making Copies
Structural Sharing
Chapter 3 Recursion and Iteration
Iteration
Very Brief Clojure Tutorial
Iteration
TCO, Clojure, and the JVM
Recursion
Chapter 4 Laziness
Lazy Accumulation
OK, but Why?
Coda
Chapter 5 Statefulness
When We MUST Mutate
Software Transactional Memory (STM)
Life Is Hard, Software Is Harder
PART II: Comparative Analysis
Chapter 6 Prime Factors
Java Version
Clojure Version
Conclusion
Chapter 7 Bowling Game
Java Version
Clojure Version
Conclusion
Chapter 8 Gossiping Bus Drivers
Java Solution
Driver
Route
Stop
Rumor
Simulation
Clojure
Conclusion
Chapter 9 Object-Oriented Programming
Functional Payroll
Namespaces and Source Files
Conclusion
Chapter 10 Types
PART III: Functional Design
Chapter 11 Data Flow
Chapter 12 SOLID
The Single Responsibility Principle (SRP)
The Open-Closed Principle (OCP)
Functions
Objects with Vtables
Multi-methods
Independent Deployability
The Liskov Substitution Principle (LSP)
The ISA Rule
Nope!
The Representative Rule
The Interface Segregation Principle (ISP)
Don’t Depend on Things You Don’t Need
Why?
Conclusion
The Dependency Inversion Principle (DIP)
A Blast from the Past
A DIP Violation
Conclusion
PART IV: Functional Pragmatics
Chapter 13 Tests
But What about the REPL?
What about Mocks?
Property-Based Testing
A Diagnostic Technique
Functional
Chapter 14 GUI
Turtle-Graphics in Quil
Chapter 15 Concurrency
Conclusion
PART V: Design Patterns
Chapter 16 Design Patterns Review
Patterns in Functional Programming
Abstract Server
Adapter
Is That Really an Adapter Object?
Command
Undo
Composite
Functional?
Decorator
Visitor
To Close, or to Clojure?
The 90-degree Problem
Abstract Factory
90 Degrees Again
Type Safety?
Conclusion
Postscript: OO Poison?
PART VI: Case Study
Chapter 17 Wa-Tor
Scratch That Itch
Showers Solve Problems
It’s Time to Wildly Reproduce
What about the Sharks?
Conclusion
Afterword
Index
A
B
C
D
E
F
G
H
I
J
L
M
N
O
P
Q
R
S
T
U
V
W
Y