Building Concurrent, Fault-Tolerant Systems with the Language of the Telecommunications Era
Introduction
- What Makes Erlang Different
- Who This Book Is For
- How to Read This Book
- A Note on Code Examples
- The Promise of This Book
Chapter 1: The Origins of Erlang
- The Telecom Crisis of the 1980s
- Joe Armstrong, Robert Virding and Mike Williams
- From a Research Project to Ericsson’s Secret Weapon
- The Design Philosophy: Let It Crash
- Open Source and the Birth of the Modern Ecosystem
Chapter 2: Philosophy and Architecture
- Immutability and Pure Functions
- The Actor Model and Message Passing
- The BEAM Virtual Machine
- Garbage Collection in a Concurrent World
- Comparing Erlang to Other Languages
Chapter 3: Getting Started with Erlang
- Installing Erlang/OTP
- The Erlang Shell (REPL)
- Your First Module
- Build Tools: Make, Rebar3 and Mix
- Editor Setup and IDEs
Chapter 4: Language Fundamentals – Syntax and Data Types
- Variables, Atoms and the Assignment Model
- Numbers: Integers, Floats and Bignums
- Tuples, Lists and Maps
- Binaries and Bit Syntax
- Operators and Expressions
Chapter 5: Pattern Matching and Control Flow
- The Power of Pattern Matching
- Function Clauses and Clause Selection
- Case Expressions and Multi-Clause Functions
- Guard Expressions
- If Expressions and the Receive Construct
Chapter 6: Functions, Modules and Recursion
- Named Functions and Module Organization
- Anonymous Functions and Closures
- Higher-Order Functions and the Lists Module
- Recursion Patterns: Tail Recursion and Accumulators
- Recursive Data Processing
Chapter 7: Concurrency – Lightweight Processes and Message Passing
- What Is an Erlang Process?
- Spawning and Communicating with Processes
- The Mailbox and Receive Semantics
- Linking and Trapping Exits
- Monitoring and the Monitored Process Registry
Chapter 8: The Open Telecom Platform (OTP) – Overview
- What Is OTP and Why Does It Exist?
- OTP Application Structure
- The Behaviour Pattern
- OTP Design Principles
- Building Your First OTP Application
Chapter 9: GenServer – The Workhorse of OTP
- What Is a GenServer?
- Implementing a GenServer
- Handling Calls, Casts and Info Messages
- State Management and the Code Change Callback
- Real-World GenServer Patterns
Chapter 10: Supervisors and Fault Tolerance
- The Supervision Tree
- Supervisor Strategies
- Building Robust Supervision Trees
- Dynamic Child Processes
- Fault Tolerance in Production
Chapter 11: Applications, Releases and Deployment
- The Application Behaviour
- Application Resource Files
- Release Management with Rebar3
- Deployment Strategies
- Monitoring and Observability
Chapter 12: Data Storage – ETS, DETS and Mnesia
- ETS – In-Memory Tables
- DETS – Disk-Based Storage
- Mnesia – Distributed Database
- Choosing the Right Storage Mechanism
- Performance and Scalability Considerations
Chapter 13: Distributed Programming
- Erlang Nodes and the Distributed Runtime
- Remote Procedure Calls and Node Communication
- Distributed Processes and Global Names
- Building Distributed Systems
- Network Partitions and Split-Brain
Chapter 14: Networking and Interoperability
- TCP and UDP Sockets
- Building Network Servers
- HTTP and Web Frameworks
- NIFs – Native Implemented Functions
- Ports and External Program Communication
Chapter 15: Error Handling, Testing and Debugging
- The Error Handling Philosophy
- Try-Catch and Exception Types
- Testing with Common Test and EUnit
- Property-Based Testing with PropEr
- Debugging, Tracing and Profiling
Chapter 16: Performance Optimization and Advanced Patterns
- Understanding Erlang Performance Characteristics
- Memory Management and Garbage Collection Tuning
- Compiler Flags and Code Optimization
- Design Patterns in OTP Applications
- The Modern Erlang Ecosystem
Chapter 17: Real-World Applications and Case Studies
- WhatsApp and the Scale of Erlang
- Riak and Distributed Databases
- RabbitMQ and Message Brokers
- Heroku’s Platform Architecture
- Lessons from Production Deployments
Conclusion: The Future of Erlang
- Where Erlang Stands Today
- Elixir and the BEAM Family
- The Continuing Relevance of OTP
- Your Path Forward