News for hackers. Stuff that matters.
Re:A Thought Experiment: Using the ECS Pattern Outside of Ga... by fulafel on Saturday December 28, 2019 @07:02AM (#21898468)
In the Clojure world, this used to be a popular way to structure backend apps: https://github.com/stuartsierra/component

> Components provide some basic guidance for structuring a Clojure application, with boundaries between different parts of a system. Components offer some encapsulation, in the sense of grouping together related entities.

> Each component receives references only to the things it needs, avoiding unnecessary shared state. Instead of reaching through multiple levels of nested maps, a component can have everything it needs at most one map lookup away.

Re:A Thought Experiment: Using the ECS Pattern Outside of Ga... by dkersten on Saturday December 28, 2019 @07:54AM (#21898629)
Stuart Sierra components and ECS components are not really the same thing though. They share the name “components” but not thaaat much else.

Stuart Sierra Components are more akin to Unity’s behaviour components prior to their introduction of an ECS. They’re a way of encapsulating state which may have dependencies and has a lifecycle (needing to be started or stopped).

ECS components are purely blobs of (usually fine grained) state, the existence and combination of which in an entity creates behaviours (that is, the systems which implement the behaviour will dynamically do so for any entity that has the prerequisite components, but the components are just data).

I always preferred naming ECS components as “traits” (they are the traits that an entity has, eg “animated”) and the systems “behaviours” (they are the behaviours exhibited by entities that have certain traits).

Re:A Thought Experiment: Using the ECS Pattern Outside of Ga... by TeMPOraL on Saturday December 28, 2019 @07:15AM (#21898505)
Used to be? What replaced it? I used it in my last Clojure project, and I'm about to start expanding it further; should I replace it with something else?
Re:A Thought Experiment: Using the ECS Pattern Outside of Ga... by heretoo on Saturday December 28, 2019 @02:49PM (#21901254)
try integrant

https://github.com/weavejester/integrant

You can move from using component's functions/macros to using a map and cross references using reader literals.

Having used both, I find integrant to work better for me.

Re:A Thought Experiment: Using the ECS Pattern Outside of Ga... by fulafel on Saturday December 28, 2019 @08:32AM (#21898784)
It's fine, hasn't just been getting much press lately.