Composing Software

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"

Author(s): Eric Elliott
Edition: 2019-02-24
Publisher: Leanpub
Year: 2019

Language: English
Pages: 229

Table of Contents......Page 3
Thank You......Page 8
Composing Software: An Introduction......Page 9
You Compose Software Every Day......Page 10
Conclusion......Page 17
Forward......Page 18
The Rise of Functional Programming......Page 20
The Rise of Functional Programming......Page 23
Functional Programming Has Always Been Alive and Well......Page 24
Why Learn Functional Programming in JavaScript?......Page 25
Mapping......Page 32
Pure Functions......Page 33
The Trouble with Shared State......Page 34
Same Input, Same Output......Page 35
No Side Effects......Page 36
Conclusion......Page 39
What is Functional Programming?......Page 40
Shared State......Page 41
Immutability......Page 44
Reusability Through Higher Order Functions......Page 45
Containers, Functors, Lists, and Streams......Page 46
Declarative vs Imperative......Page 47
Conclusion......Page 48
Expressions and Values......Page 50
Types......Page 51
Destructuring......Page 52
Comparisons and Ternaries......Page 53
Functions......Page 54
Currying......Page 58
Function Composition......Page 60
Method Chaining......Page 61
Conclusion......Page 62
Higher Order Functions......Page 63
What is a curried function?......Page 66
What is point-free style?......Page 67
Why do we curry?......Page 68
Trace......Page 70
Curry and Function Composition, Together......Page 71
Conclusion......Page 76
Abstraction & Composition......Page 78
Abstraction in Software......Page 79
Abstraction through composition......Page 80
How to Do More with Less Code......Page 81
Reduce......Page 82
Reduce is Versatile......Page 83
Conclusion......Page 87
Functors & Categories......Page 88
Why Functors?......Page 89
Functor Laws......Page 92
Category Theory......Page 94
Build Your Own Functor......Page 96
Curried Map......Page 97
Conclusion......Page 98
Monads......Page 99
You're probably already using monads.......Page 101
What Monads are Made of......Page 106
Building a Kleisli Composition Function......Page 109
The Monad Laws......Page 112
Conclusion......Page 115
The Forgotten History of OOP......Page 117
The Big Idea......Page 118
The Essence of OOP......Page 120
What OOP Doesn't Mean......Page 121
What is an object?......Page 123
We've lost the plot.......Page 124
Object Composition......Page 126
What is Object Composition?......Page 127
Notes on Code Examples......Page 128
Aggregation......Page 129
Concatenation......Page 131
Delegation......Page 132
Conclusion......Page 134
Factory Functions......Page 136
Literals for One, Factories for Many......Page 137
Destructuring......Page 138
Computed Property Keys......Page 139
Default Parameters......Page 140
Type Inference......Page 141
Factory Functions for Mixin Composition......Page 143
Conclusion......Page 145
Motivation......Page 147
What are mixins?......Page 148
What is functional inheritance?......Page 149
What is a functional mixin?......Page 150
Composing Functional Mixins......Page 151
Caveats......Page 152
Conclusion......Page 157
The Delegate Prototype......Page 158
The .constructor Property......Page 160
Class to Factory is a Breaking Change......Page 163
Composable Custom Data Types......Page 169
Composable Currency......Page 172
Lenses......Page 174
Background......Page 175
Lens Laws......Page 176
Composing Lenses......Page 178
Transducers......Page 181
Why Transducers?......Page 182
Background and Etymology......Page 184
A Musical Analogy for Transducers......Page 186
Transducer Rules......Page 192
Transducing......Page 194
The Transducer Protocol......Page 196
Conclusion......Page 197
1. Make the function the unit of composition. One job for each function.......Page 199
2. Omit needless code.......Page 200
3. Use active voice.......Page 204
4. Avoid a succession of loose statements.......Page 205
6. Put statements and expressions in positive form.......Page 207
7. Use parallel code for parallel concepts.......Page 209
Conclusion: Code should be simple, not simplistic.......Page 210
TDD should lead to better design.......Page 212
What is a mock?......Page 213
What is test coverage?......Page 214
What is tight coupling?......Page 215
What does composition have to do with mocking?......Page 216
How do we remove coupling?......Page 219
``Code smells'' are warning signs, not laws. Mocks are not evil.......Page 227