Skip to content
0:00 / 0:00

#clojure#component#stuartsierra

Stuart Sierra - Components Just Enough Structure

ClojureTV

111K subscribers • 136 videos on Hallway

YouTube
  • Recommended by 4 people: 2 on Hacker News and 2 in engineering communities.
  • A classic. People kept recommending it from 2014 to 2024.
  • Presented by Stuart Sierra, Clojure developer
  • An opinion. It argues one side of a question engineers disagree on.

Intermediate. Assumes working knowledge.

35K views12 years ago4 recommendations

Software designProgramming languagesSoftware architectureLisp and ClojureFunctional programming

Stuart Sierra introduces the Component pattern and library for Clojure to manage lifecycle and dependencies of stateful services without global state.

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 talk builds on the concepts in last year's "Clojure in the Large" but does not assume viewers have seen that talk first.

Why it's here

4 people recommend this

What people say. Recommended as a foundational talk on structuring large Clojure applications and managing stateful dependencies.

u/ringbuffer__in r/Clojure • Recommends

This guy's talks are always clear and easy to understand

u/jknin r/Clojure • Recommends

Components Just Enough Structure

nilliamson Hacker News • Recommends

On “Spider Programming Language”

Can't agree with your implication that 'real JS stuff' won't get done and 'JS people' won't get on board due to its 'focus on OOP'. I've yet to see a large JS app written in a 'functional style'. Most large client-side apps I've come across are written in Backbone, Angular, Ember etc. which are all frameworks/libraries that embrace OOP. You shouldn't mistake JavaScript's 'prototypal' nature for it being a non-OOP language. JavaScript and OOP are a very good fit. > The people who will appreciate the trappings of OOP are more than likely the typical classically trained programmers, who will write 300 lines of Spider on the frontend of their Python hobby project, and not touch it again. If you'…

nowprovisionon Hacker News • Recommends

On “Your DI framework is killing your code”

This talk might be of interest Stuart Sierra - Components Just Enough Structure link to this video - it is a tiny clojure framework but the ideas should be thought provoking, although granted with OO aligned type system not completely adaptable. In this example Customer could possibly just be a data-bucket/map/hashtable/Dictionary, Im not entirely sure how I'd handle reporting though as the example has put me back in OO mode, but a customer report (which knows how to organize data about a customer) shouldnt be part of customer entity (used loosely) in my opinion.

u/Platzin r/haskell • Mentions

On “Edward Kmett - Encapsulation vs. Code Reuse”

They've had to somewhat refine the naive approach to this, see Stuart Sierra's talk on the challenges they faced wit that they're currently considering as a way to go forward... link to this video

jared314on Hacker News • Mentions

On “Introducing .NET Core”

> but once you need to go for something bigger, with big teams, the thing start to melt down. The people in the Clojure community have already started exploring this issue. Component 1 2, Jig 3, and others are trying to add just enough OOP back for the reasons you mentioned. 1 link 2 link to this video 3 link

nilliamson Hacker News • Mentions

On “React’s diff algorithm (2013)”

…jure community has been very frustrating, I find very few answers on how to actually compose large apps, and the answers I do find basically point back to OOP (but implemented in a syntax-less, ad-hoc manner 1). If I've got this wrong, please tell me, I'm dying for better answers. 0 link 1 Stuart Sierra - Components Just Enough Structure - link to this video…