Composing Software
Course Info
This course includes 5 attempts.
All software design is composition: the act of breaking complex problems down into smaller problems and composing those solutions. Most developers have a limited understanding of compositional techniques. It's time for that to change.
In "Composing Software", Eric Elliott shares the fundamentals of composition, including both function composition and object composition, and explores them in the context of JavaScript. The course covers the foundations of both functional programming and object oriented programming to help the reader better understand how to build and structure complex applications using simple building blocks.
You'll learn:
- Functional programming
- Object composition
- How to work with composite data structures
- Closures
- Higher order functions
- Functors (e.g., array.map)
- Monads (e.g., promises)
- Transducers
- Lenses
All of this in the context of JavaScript, the most used programming language in the world. But the learning doesn't stop at JavaScript. You'll be able to apply these lessons to any language. This course is about the timeless principles of software composition and its lessons will outlast the hot languages and frameworks of today. Unlike most programming books, this one may still be relevant 20 years from now.
This book this course is based on began life as a popular blog post series that attracted hundreds of thousands of readers and influenced the way software is built at many high growth tech startups and fortune 500 companies.
Course Material
- 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
- The Dao of Immutability (The Way of the Functional Programmer)
- Forward
- The Rise and Fall and Rise of Functional Programming (Composable Software)
- The Rise of Functional Programming
- The Fall of Functional Programming
- The Rise of Functional Programming
- Functional Programming Has Always Been Alive and Well
- Why Learn Functional Programming in JavaScript?
- What JavaScript is Missing
- What JavaScript Has that Pure Functional Languages Lack
- Pure Functions
- What is a Function?
- Mapping
- Pure Functions
- The Trouble with Shared State
- Same Input, Same Output
- No Side Effects
- Immutability
- Conclusion
- What is Functional Programming?
- Pure Functions
- Function Composition
- Shared State
- Immutability
- Side Effects
- Reusability Through Higher Order Functions
- Containers, Functors, Lists, and Streams
- Declarative vs Imperative
- Conclusion
- A Functional Programmer’s Introduction to JavaScript
- Expressions and Values
- var, let, and const
- Types
- Destructuring
- Comparisons and Ternaries
- Functions
- Signatures
- Default Parameter Values
- Named Arguments
- Rest and Spread
- Currying
- Function Composition
- Arrays
- Method Chaining
- Conclusion
- Higher Order Functions
- Curry and Function Composition
- What is a curried function?
- What is a partial application?
- What’s the Difference?
- What is point-free style?
- Why do we curry?
- Trace
- Curry and Function Composition, Together
- Conclusion
- Abstraction & Composition
- Abstraction is simplification.
- Abstraction in Software
- Abstraction through composition
- How to Do More with Less Code
- Conclusion
- Reduce
- Reduce is Versatile
- A Word on Redux
- Conclusion
- Abstract Data Types and the Software Crisis
- Common ADT Examples
- Why ADTs?
- History of ADTs
- Specifications for ADTs
- Stack ADT Example
- Definitions
- Abstract Signatures
- Construction
- Stack Operations (operations which return a stack)
- Axioms
- Identity
- Sequence
- Empty
- Concrete Implementations
- Conclusion
- Glossary
- Functors & Categories
- Why Functors?
- Functor Laws
- Identity
- Composition
- Category Theory
- Build Your Own Functor
- Curried Map
- Conclusion
- Monads
- You’re probably already using monads.
- What Monads are Made of
- Building a Kleisli Composition Function
- The Monad Laws
- Left and right identity laws
- Associativity law
- Identity Laws
- Associativity
- Proving the Monad Laws
- Conclusion
- The Forgotten History of OOP
- The Big Idea
- The Essence of OOP
- What OOP Doesn’t Mean
- What is an object?
- We’ve lost the plot.
- Characteristics of Message Passing
- Object Composition
- What is Object Composition?
- Three Different Forms of Object Composition
- Notes on Code Examples
- Aggregation
- Examples
- When to use
- Considerations
- In Code
- Concatenation
- Examples
- When to Use
- Considerations
- In Code
- Delegation
- Examples
- When to Use
- Considerations
- In Code
- Conclusion
- Factory Functions
- Literals for One, Factories for Many
- Returning Objects
- Destructuring
- Computed Property Keys
- Default Parameters
- Type Inference
- Factory Functions for Mixin Composition
- Conclusion
- Functional Mixins
- Motivation
- What are mixins?
- What is functional inheritance?
- What is a functional mixin?
- Composing Functional Mixins
- When to Use Functional Mixins
- Caveats
- Classes
- Class Performance
- Implicit Dependencies
- Functional Mixins & Functional Programming
- Conclusion
- Why Composition is Harder with Classes
- The Delegate Prototype
- The .constructor Property
- 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
- Composable Custom Data Types
- You can do this with any data type
- Composable Currency
- Lenses
- Why Lenses?
- Background
- Lens Laws
- Composing Lenses
- Over
- Transducers
- Why Transducers?
- Background and Etymology
- A Musical Analogy for Transducers
- Transducers compose top-to-bottom.
- Transducer Rules
- Initialization
- Early Termination
- Completion
- Transducing
- The Transducer Protocol
- Conclusion
- Elements of JavaScript Style
- 1. Make the function the unit of composition. One job for each function.
- 2. Omit needless code.
- Omit needless variables.
- 3. Use active voice.
- Event Handlers
- Lifecycle Methods
- 4. Avoid a succession of loose statements.
- 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.
- 7. Use parallel code for parallel concepts.
- Conclusion: Code should be simple, not simplistic.
- Mocking is a Code Smell
- TDD should lead to better design.
- What is a code smell?
- What is a mock?
- What is a unit test?
- What is test coverage?
- What is tight coupling?
- What causes tight coupling?
- What does composition have to do with mocking?
- 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
- “Code smells” are warning signs, not laws. Mocks are not evil.
- Mocking is great for integration tests
Instructors
Eric Elliott is a Webby-nominated software engineering expert, author, and creator of SudoLang, an AI programming language. With over 10 years of experience deploying AI models at scale to millions of users, he built and trained production AI models, and was an early pioneer of prompt engineering and AI Driven Development (AIDD). He has served as an engineering manager working on Generative AI for Adobe Firefly, tech lead on a social video AI app spun out of Stanford Research Institute, and a JavaScript expert and consultant on software development productivity and AIDD.
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them