␡
- The Takeaway
- Same Data Used for Different Purposes
- Data Source or Subject
- Data Sinks or Observers
- Running the Code
- Separation of ConcernsData Producer-Consumer
- Conclusion
- Resources
Like this article? We recommend
Separation of Concerns—Data Producer-Consumer
On a slightly deeper level, what you see here is a separation of concerns, which is the division of data production and data consumption into separate classes. Providing such a demarcation helps improve code modularity (e.g., if data originates in a database, then a split allows for data to come from other sources). If the observer pattern is well-implemented, changes to the data production code should have minimal impact on the data consumption code.