Go 的观察者模式
译者:baiyutang
原文:https://medium.com/@srinjoysantra/observer-pattern-in-go-aebbe83785b5
This is the second chapter of Head First Design Patterns book. Though the book has code snippets in Java, my attempt here is to implement the problem discussed in Go. Without further ado, let’s understand the use-case.
The problem statement
We are told to design a weather monitoring application. It consists of 3 sections
Weather station : to record humidity, temperature and pressure
Weather data : tracks data from the weather station and forwards it to the displays
various display elements :
current conditions,
weather statistics,
a simple forecast, and
a heat index calculator
UML 类图
输出
版权声明: 本文为 InfoQ 作者【baiyutang】的原创文章。
原文链接:【http://xie.infoq.cn/article/39181c5e020b3e3106ed9cbce】。
本文遵守【CC-BY 4.0】协议,转载请保留原文出处及本版权声明。
评论