Functional Programming Lectures
Overview
This series of lectures explores functional programming concepts from fundamentals to advanced applications in modern development. The curriculum is designed with a lean and modular approach, emphasizing separation of concerns and functional programming principles throughout. As you progress, you’ll learn how to build maintainable, scalable applications using pure functions, immutable data structures, and modern state management architecture patterns.
Key Learning Philosophy:
- Start thinking in pure functions from the beginning
- Embrace immutability as your default approach
- Leverage TypeScript’s type system to its fullest
- Keep side effects isolated at your application boundaries
- Build complexity through composition, not inheritance
- Choose state ownership before choosing a tool: local editing stays local, URL state stays with the router, shared durable client state uses Redux Toolkit, and reusable server data uses RTK Query
- Organize by feature and split files when ownership or responsibility becomes clearer
Architecture Principles You’ll Master:
- Avoid unnecessary code, duplication, and bloat in your codebase
- Keep domain transitions in pure functions or reducers while components own view-specific interaction state
- Use event-oriented actions, pure reducers, selectors for derived data, and typed React-Redux hooks
- Use thunks for imperative workflows and listener middleware for workflows that react to later actions or state transitions
- Use one RTK Query API per base URL and split feature endpoints with
injectEndpoints - Apply entity-component-system architecture only when the domain genuinely consists of entities, composable components, and systems
- Keep domain boundaries explicit and centralize only genuinely cross-cutting infrastructure
- Colocate related slice, selector, endpoint, component, and test code by feature
- Separate setup code from your core application rules
- Distribute feature logic and centralize only cross-cutting infrastructure
“All software design is composition: the act of breaking complex problems down into smaller problems and composing those solutions. Learn to do it well.” - Eric Elliott
Glossary
The glossary at the end of this page defines the basic programming terms used throughout the course.
TypeScript
TypeScript is a superset of JavaScript that adds static typing to the language.
TypeScript will be the language of choice for this course.
Learning Path & Lectures
1. Fundamentals
- The Simplest FP TS Hello World - Basic pure function example
- Basic TypeScript Knowledge - Core TypeScript concepts for FP
- What is a Function? - Function fundamentals and pure functions
- Basic Functional Programming Knowledge - Core FP concepts
- ES6+ Features for Functional Programming - Modern JS/TS features
- TypeScript and Functional Programming - Type safety in FP
2. Intermediate
- Redux Standard Patterns and Functional Programming - Event, reducer, selector, and render dataflow
- Redux Toolkit and Functional Programming - Modern Redux with RTK
- Functional Composition - Advanced composition techniques
3. Advanced
- Monads in Functional Programming - Monadic programming
- Advanced Monad Transformers - Combining monadic effects
- Category Theory Fundamentals - Mathematical foundations
4. Applications
- Practical Applications of Functional Programming - Real-world FP
- Performance Optimization Techniques - FP performance
- Functional Programming in Other Languages - FP across languages
5. Maintenance & Architecture
- Functional Programming Maintenance Strategy - Maintaining FP codebases
- Redux Toolkit and RTK Query Best Practices - RTK and RTK Query
- Modern Redux Architecture Patterns - Scalable Redux patterns
Install the Skill
The working contract taught across this curriculum is distilled into a coding-agent skill in its own repository: functional-programming-composition/fp. Install it directly:
npx skills@latest add functional-programming-composition/fp
Programming Glossary
-
Expression: A piece of code that produces a value. Expressions can be evaluated and always return a result (e.g.,
2 + 3,Math.max(a, b),user.name). -
Statement: A complete instruction that performs an action. Statements don’t return values but execute code (e.g.,
if (condition) { ... },return value;,const x = 5;). -
Declaration: Code that introduces a new variable, function, or type into scope. Declarations create bindings but don’t necessarily execute code.
-
Assignment: The process of storing a value in a variable. In functional programming, assignments are often avoided in favor of immutable declarations.
-
Variable: A named container that stores a value. In functional programming, variables are often immutable to prevent side effects and ensure referential transparency.
-
Const: A variable that is immutable. In functional programming, variables should be immutable to prevent side effects and ensure referential transparency.
constis a better choice thanletbecause it’s more explicit and less error-prone. -
Gate: A logical operator that controls data flow (AND, OR, NOT). Gates are pure functions that combine boolean values.
-
Boolean: A data type with only two possible values: true or false. Booleans are fundamental to conditional logic and functional programming.
-
Number: A numeric data type for mathematical operations. In functional programming, numbers are immutable and operations return new values.
-
String: A sequence of characters representing text. Strings are immutable in most functional programming contexts.
-
Array: An ordered collection of elements. Arrays are fundamental to functional programming for data transformation operations.
-
Object: A collection of key-value pairs representing a real-world entity. In functional programming, objects should be immutable.
-
Method: A function that belongs to an object or class. Methods can access the object’s state and modify it (though this is avoided in functional programming).
-
Function: A reusable block of code that takes inputs (parameters) and returns an output. In functional programming, functions should be pure - same input always produces same output with no side effects.
-
Type: A classification of data that defines what operations can be performed on it. Types provide compile-time safety and documentation.
-
Argument: The actual value passed to a function when it’s called. Arguments are the concrete data that functions operate on.
-
Parameter: The placeholder variable in a function definition that receives arguments. Parameters define the function’s interface and expected input types.
-
Attribute: A property or characteristic of an object. In functional programming, object attributes should be immutable to prevent side effects.
-
Return: A statement that exits a function and provides a value back to the caller. Return values should be the only way functions communicate results.
-
Side effect: Any change to the system outside the function (modifying global state, making API calls, logging). Pure functions avoid side effects.
-
Event: A signal that something has happened in the system (user interaction, timer completion, data arrival). Events are the foundation of reactive programming.
-
Listener: A function that waits for and responds to events. Listeners are pure functions that process event data without side effects.
-
Handler: A function that processes a specific event or action. Handlers should be pure functions that transform input data into output data.
-
Callback: A function passed as an argument to another function, to be executed later. Callbacks enable asynchronous programming and function composition.
-
Promise: An object representing the eventual completion (or failure) of an asynchronous operation. Promises provide a clean way to handle async operations functionally.
-
Async/await: Syntactic sugar for working with promises. Async functions return promises, and await pauses execution until a promise resolves.
-
Symbol: A unique, immutable primitive value used as object property keys. Symbols provide a way to create truly private properties.
-
Null: A special value representing the intentional absence of any object value. In functional programming, null is often replaced with Maybe/Option types.
-
Undefined: A value assigned to variables that have been declared but not initialized. Undefined represents an unassigned value.
-
NaN: “Not a Number” - a special numeric value representing an undefined or unrepresentable mathematical result.
-
Interface: A TypeScript construct that defines the shape of an object. Interfaces describe contracts that objects must fulfill.
-
Class: A blueprint for creating objects with shared properties and methods. Classes are less common in functional programming, which prefers plain objects and functions.
-
Set: A collection of unique values with no duplicates. Sets are useful for functional programming operations like union, intersection, and difference.
-
Loop: A control structure that repeats code execution. In functional programming, loops are often replaced with higher-order functions like map, filter, and reduce.
-
Condition: A boolean expression that determines program flow. Conditions are used in if statements and ternary operators.
-
Iteration: The process of repeating a set of instructions. In functional programming, iteration is handled through recursion or higher-order functions.
-
Recursion: A function calling itself to solve a problem by breaking it into smaller subproblems. Recursion is fundamental to functional programming.