Managing State in Elixir: Processes vs. Functions

5
clicks
Managing State in Elixir: Processes vs. Functions
The article explores the decision-making process in Elixir programming regarding whether to use processes or keep everything within a single process when managing state. It introduces the concepts of 'thought concerns' and 'runtime concerns', arguing against using processes to separate thought concerns. Concrete examples are provided, including a blackjack game model where a single process is advocated for managing a round's state, while emphasizing that different rounds can be handled in separate processes to leverage concurrency and fault tolerance. The author encourages using functions and modules to organize code functionally without overcomplicating with processes, promoting cleaner abstractions for managing game state, player actions, and notifications without entwining complex domain logic with runtime behavior.

© HashMerge 2025