Message Passing: Actors communicate exclusively by sending immutable messages, never by direct method calls or shared memory. Message passing means parts of a system communicate by sending messages instead of calling each other's methods or sharing memory. The sender puts a message in the receiver's mailbox and moves on. In the actor model, messages are immutable, so once sent, nobody can change them. Each actor only sees its own state, which removes most concurrency bugs by design.
What should you keep in mind with Message Passing?
The same idea scales up to whole systems. Services sending messages through a queue or event bus are loosely coupled: the sender does not wait, and the receiver can be down for a moment without losing the message. The trade-off is that you need to think about delivery: what happens if a message arrives twice, arrives late, or never arrives. Idempotent handlers and clear retry rules answer those questions.
Use when code runs things at the same time - threads, async/await, queues and workers, parallel requests, cron jobs, webhooks that retry - or when a bug only happens "sometimes" or under load. Covers race conditions, deadlocks, mutexes/locks, atomic operations, idempotency, message queues and backpressure, with Laravel and database examples.
Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.