A descriptive series on the design patterns based on the O’Reily book of the same name adapted to Go from Java

Table of Contents

0.  Introduction

  1. Welcome to Design Patterns: the Strategy Pattern
  2. Keeping your Objects in the know: the Observer Pattern
  3. Decorating Objects: the Decorator Pattern
  4. Baking with OO goodness: the Factory Pattern
  5. Encapsulating Invocation: the Command Pattern
  6. Being Adaptive: the Adapter and Facade Patterns
  7. Encapsulating Algorithms: the Template Method Pattern
  8. Well-managed Collections: the Iterator and Composite Patterns
  9. The State of Things: the State Pattern
  10. Controlling Object Access: the Proxy Pattern
  11. Patterns of Patterns: Compound Patterns

This series of articles will run you by the design patterns the way it is explained in the Head First Design Patterns book using Go as the coding language.

Problem Statement 1:

  • There is a WeatherData object which tracks current weather conditions (temperature, humidity and barometric pressure).
  • Develop a Weather Monitoring Station that uses this object to provide three display elements : current conditions, weather statistics and a simple forecast, all updated in real time as in we acquire the most recent measurements.

Solution:

  • 3 players in the system : the weather station (the physical device that acquires the actual weather data), the WeatherData object (that tracks the data coming from the Weather Station and updates the displays), and the display that shows users the current weather conditions.

#golang #programming #design-patterns

Head First Design Patterns using Go — 2. Keeping your Objects in the know:Observer Pattern
1.40 GEEK