Skip to content

linhhonblade/design_pattern_with_go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design Patterns with Golang

Reference: https://refactoring.guru/design-patterns

Here some quick notes

Behavorial Patterns

Observer

  • Things that notify others about their changes in state should implement the publisher interface
  • Things that want to track changes to the publisher's state should implement the subscriber interface

The publisher interface includes:

  • an array storing references to subscriber objects
  • method to add/remove subscriber from above list

The subscriber interface includes:

  • the notification method

Others

  • all subscribers should implement the same interface
  • and the publisher communicate with them via that only interface
  • if you have many subscriber interface and want subcribers to be compatible with them, you can go further and make those subsriber implement one interface

About

suffering go and design pattern

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages