The design pattern redux
The GOF pattern and reactive programming have a deeper connection that is obvious from the surface. The GOF pattern is mostly concerned with writing OOP-based programs. Reactive programming is about functional programming, stream programming, and concurrency. We already learned that reactive programming covers some deficiencies in classic GOF observer patterns (in the first section of Chapter 5, Introduction to Observables, we covered this deficiency).
OOP programs are basically about modeling hierarchies, and from the pattern world, the composite pattern is the way to model part/whole hierarchies. Wherever there is a composite, a collection of visitor implementations will follow suit. In other words, the composite-visitor duo is the canonical pattern for writing object-oriented systems.
The visitor implementations should possess some awareness of the structure of the composites. Behavioral processing using the visitor pattern becomes difficult, as the number of visitors...