8. Composite

1. Motivation

  • Treat individual or group of objects uniformly
  • e.g. Have similar API for Foo and sequence of Foo.

Geometric shapes

Neural Networks

Summary

  • Composition
  • Composed and singular objects need similar / identical behviours
  • Python __iter__ and Iterable ABC