Introduction
- Thank You
- Composing Software: An Introduction
- You Compose Software Every Day
- Composing Functions
- Working Memory
- Signal to Noise Ratio
- Surface Area for Bugs
- Composing Objects
- Conclusion
- Exercise 1
- The Dao of Immutability (The Way of the Functional Programmer)
- Forward
- Exercise 2
- Quiz 1
The Rise and Fall and Rise of Functional Programming (Composable Software)
- The Rise of Functional Programming
- Exercise 3
- The Fall of Functional Programming
- The Rise of Functional Programming
- Functional Programming Has Always Been Alive and Well
- Quiz 2
Why Learn Functional Programming in JavaScript?
- What JavaScript is Missing
- What JavaScript Has that Pure Functional Languages Lack
- Quiz 3
Pure Functions
- What is a Function?
- Exercise 4
- Mapping
- Exercise 5
- Pure Functions
- Exercise 6
- The Trouble with Shared State
- Exercise 7
- Same Input, Same Output
- Exercise 8
- No Side Effects
- Immutability
- Exercise 9
- Conclusion
- Exercise 10
- Quiz 4
What is Functional Programming?
- Pure Functions
- Exercise 11
- Function Composition
- Shared State
- Exercise 12
- Immutability
- Exercise 13
- Side Effects
- Exercise 14
- Reusability Through Higher Order Functions
- Exercise 15
- Containers, Functors, Lists, and Streams
- Exercise 16
- Declarative vs Imperative
- Conclusion
- Exercise 17
- Quiz 5
A Functional Programmer’s Introduction to JavaScript
- Expressions and Values
- var, let, and const
- Types
- Exercise 18
- Destructuring
- Comparisons and Ternaries
- Exercise 19
- Functions
- Signatures
- Default Parameter Values
- Named Arguments
- Rest and Spread
- Exercise 20
- Currying
- Exercise 21
- Function Composition
- Exercise 22
- Arrays
- Exercise 23
- Method Chaining
- Exercise 24
- Conclusion
- Quiz 6
Higher Order Functions
- Exercise 25
- Quiz 7
Curry and Function Composition
- What is a curried function?
- Exercise 26
- What is a partial application?
- What’s the Difference?
- Exercise 27
- What is point-free style?
- Exercise 28
- Why do we curry?
- Exercise 29
- Trace
- Exercise 30
- Curry and Function Composition, Together
- Exercise 31
- Conclusion
- Exercise 32
- Quiz 8
Abstraction & Composition
- Exercise 33
- Abstraction is simplification.
- Exercise 34
- Abstraction in Software
- Exercise 35
- Abstraction through composition
- Exercise 36
- How to Do More with Less Code
- Exercise 37
- Conclusion
- Exercise 38
- Reduce
- Exercise 39
- Reduce is Versatile
- A Word on Redux
- Exercise 40
- Conclusion
- Quiz 9
Abstract Data Types and the Software Crisis
- Common ADT Examples
- Exercise 41
- Why ADTs?
- History of ADTs
- Exercise 42
- Specifications for ADTs
- Exercise 43
- Stack ADT Example
- Definitions
- Abstract Signatures
- Construction
- Stack Operations (operations which return a stack)
- Axioms
- Identity
- Sequence
- Empty
- Exercise 44
- Concrete Implementations
- Exercise 45
- Conclusion
- Exercise 46
- Glossary
- Quiz 10
Functors & Categories
- Exercise 47
- Why Functors?
- Exercise 48
- Functor Laws
- Identity
- Composition
- Exercise 49
- Category Theory
- Exercise 50
- Build Your Own Functor
- Exercise 51
- Curried Map
- Exercise 52
- Conclusion
- Exercise 53
- Quiz 11
Monads
- Exercise 54
- You’re probably already using monads.
- Exercise 55
- What Monads are Made of
- Exercise 56
- Building a Kleisli Composition Function
- Exercise 57
- The Monad Laws
- Left and right identity laws
- Associativity law
- Identity Laws
- Associativity
- Proving the Monad Laws
- Exercise 58
- Conclusion
- Exercise 59
- Quiz 12
The Forgotten History of OOP
- Exercise 60
- The Big Idea
- Exercise 61
- The Essence of OOP
- Exercise 62
- What OOP Doesn’t Mean
- Exercise 63
- What is an object?
- Exercise 64
- We’ve lost the plot.
- Characteristics of Message Passing
- Exercise 65
- Quiz 13
Object Composition
- Exercise 66
- What is Object Composition?
- Exercise 67
- Three Different Forms of Object Composition
- Exercise 68
- Notes on Code Examples
- Exercise 69
- Aggregation
- Examples
- When to use
- Considerations
- In Code
- Exercise 70
- Concatenation
- Examples
- When to Use
- Considerations
- In Code
- Exercise 71
- Delegation
- Examples
- When to Use
- Considerations
- In Code
- Exercise 72
- Conclusion
- Exercise 73
- Quiz 14
Factory Functions
- Exercise 74
- Literals for One, Factories for Many
- Exercise 75
- Returning Objects
- Exercise 76
- Destructuring
- Exercise 77
- Computed Property Keys
- Default Parameters
- Exercise 78
- Type Inference
- Exercise 79
- Factory Functions for Mixin Composition
- Exercise 80
- Conclusion
- Quiz 15
Functional Mixins
- Exercise 81
- Motivation
- Exercise 82
- What are mixins?
- Exercise 83
- What is functional inheritance?
- Exercise 84
- What is a functional mixin?
- Exercise 85
- Composing Functional Mixins
- Exercise 86
- When to Use Functional Mixins
- Exercise 87
- Caveats
- Classes
- Class Performance
- Implicit Dependencies
- Functional Mixins & Functional Programming
- Exercise 88
- Conclusion
- Exercise 89
- Quiz 16
Why Composition is Harder with Classes
- Exercise 90
- The Delegate Prototype
- Exercise 91
- The .constructor Property
- Exercise 92
- Class to Factory is a Breaking Change
- Code that Requires new Violates the Open/Closed Principle
- The class Keyword and extends
- Friendly Syntax
- Performance and Memory
- Type Checking
- Class Inheritance with extends
- Classes are OK if You’re Careful
- Exercise 93
- Quiz 17
Composable Custom Data Types
- Exercise 94
- You can do this with any data type
- Composable Currency
- Exercise 95
- Quiz 18
Lenses
- Exercise 96
- Why Lenses?
- Exercise 97
- Background
- Lens Laws
- Exercise 98
- Composing Lenses
- Over
- Exercise 99
- Quiz 19
Transducers
- Exercise 100
- Why Transducers?
- Exercise 101
- Background and Etymology
- A Musical Analogy for Transducers
- Exercise 102
- Transducers compose top-to-bottom.
- Exercise 103
- Transducer Rules
- Initialization
- Early Termination
- Completion
- Exercise 104
- Transducing
- Exercise 105
- The Transducer Protocol
- Exercise 106
- Conclusion
- Exercise 107
- Quiz 20
Elements of JavaScript Style
- Exercise 108
- 1. Make the function the unit of composition. One job for each function.
- Exercise 109
- 2. Omit needless code.
- Omit needless variables.
- Exercise 110
- 3. Use active voice.
- Event Handlers
- Lifecycle Methods
- Exercise 111
- 4. Avoid a succession of loose statements.
- Exercise 112
- 5. Keep related code together.
- 6. Put statements and expressions in positive form.
- If Statements
- Ternaries
- Prefer strong negative statements.
- Avoid null and undefined arguments in function calls.
- Exercise 113
- 7. Use parallel code for parallel concepts.
- Exercise 114
- Conclusion: Code should be simple, not simplistic.
- Exercise 115
- Quiz 21
Mocking is a Code Smell
- Exercise 116
- TDD should lead to better design.
- Exercise 117
- What is a code smell?
- Exercise 118
- What is a mock?
- Exercise 119
- What is a unit test?
- Exercise 120
- What is test coverage?
- Exercise 121
- What is tight coupling?
- Exercise 122
- What causes tight coupling?
- Exercise 123
- What does composition have to do with mocking?
- Exercise 124
- How do we remove coupling?
- Use pure functions
- Isolate side-effects from the rest of your program logic
- Use pub/sub
- Isolate logic from I/O
- Use objects that represent future computations
- Exercise 125
- “Code smells” are warning signs, not laws. Mocks are not evil.
- Mocking is great for integration tests
- Exercise 126
- Quiz 22
