Eric Elliott
Sep 8, 2018 · 1 min read

Whether you realize it or not, if you’re a working developer, you use object composition all the time.

I rarely use it for behaviors (I favor simple functions and module imports for code reuse), but I use it frequently to manipulate data structures.

For example, I frequently use object concatenation in Redux reducers.

Every time you build or use an array, you’re using an aggregation (a form of object composition).

Every time you use a built-in object or array method, you’re using delegation (another form of object composition).

Most graphical components use some variant of the composite pattern, where an object encapsulates access to contained child objects.

Eric Elliott

Written by

Make some magic. #JavaScript