Functional programming with immutable values is wonderful, but sooner or later every program has to deal with mutable, stateful, imperative tasks. A large program may need to manage dozens of stateful services: database connections, thread pools, network services, scheduled tasks, and caches. How do we do this in a functional programming model? All too often we fall back, almost by accident, into global mutable state, promiscuous sharing, and imperative spaghetti code. To escape this quagmire, we need to recall some basic principles of both functional and object-oriented programming: referential transparency, immutable values, message-passing, encapsulation, and interface contracts. The Component pattern and its library implementation offer a minimal way to structure the stateful dependencies of a functional program. This talk will cover the motivation for the Component pattern, its benefits and downsides, comparisons with other approaches, and how to use it in Clojure programs. This presentation is a follow-up to my Clojure/West talk, "Components: Just Enough Structure,"
Bio: Stuart Sierra is a programmer, actor, musician, and writer. He lives in New York City and works for Cognitect. He is the co-author, with Luke VanderHart, of ClojureScript: Up and Running (O'Reilly) and Practical Clojure (Apress).
Pizza, beer and soft drinks provided by Meetup.