How rifannurmuhammad/design-pattern works
This Go repository is a set of independent design-pattern examples, not a single application. Its main runnable demonstration creates food through the factory example and constructs a workspace through the builder example; other patterns illustrate their own behaviors independently. The tree documents creational, structural, and behavioral pattern families, plus an option-pattern example. Sampled source supports several internal interactions; other pattern modules are represented from their paths, without inferring connections between them.
Main entry points: main.go Example main · bridge.go Device bridge · context.go Trip strategy · factory.go Factory method
Components 30
Runnable examples
- Example main
main.go
Creational patterns
- Factory method
creational_pattern/factory/factory.go - Food products
creational_pattern/factory/factory.go - Workspace builder
creational_pattern/builder/builder.go - Abstract factory
creational_pattern/abstract_factory/abstract_factory.go - Xiaomi factory
creational_pattern/abstract_factory/xiaomi/factory.go - Xiaomi products
creational_pattern/abstract_factory/xiaomi/product - Prototype
creational_pattern/prototype/prototype.go - Singleton
creational_pattern/singleton/singleton.go
Structural patterns
- Currency adapter
structural_pattern/adapter/adapter.go - Device bridge
structural_pattern/bridge/bridge.go - OS implementations
structural_pattern/bridge/bridge_os.go - Color implementations
structural_pattern/bridge/bridge_color.go - Product composite
structural_pattern/composite/composite.go - Coffee decorator
structural_pattern/decorator/decorator.go - Facade
structural_pattern/facade/facade.go - Logistics proxy
structural_pattern/proxy/proxy.go - Logistics service
structural_pattern/proxy/proxy.go
Behavioral patterns
- Registration chain
behavioral_pattern/chain_of_responsibility/chain_of_responsibility.go - Profile handler
behavioral_pattern/chain_of_responsibility/chain_of_responsibility.go - Experience handler
behavioral_pattern/chain_of_responsibility/chain_of_responsibility.go - Education handler
behavioral_pattern/chain_of_responsibility/chain_of_responsibility.go - Trip strategy
behavioral_pattern/strategy/context.go - Road strategy
behavioral_pattern/strategy/road.go - Flight strategy
behavioral_pattern/strategy/flight.go - Command
behavioral_pattern/command/command.go - State pattern
behavioral_pattern/state - Visitor
behavioral_pattern/visitor/interface.go
Option pattern
- Car options
option_pattern/main.go
Other components
- Go caller
Connections 14
- Go caller → Example main: runs
- Example main → Factory method: calls
- Example main → Workspace builder: calls
- Factory method → Food products: creates
- Abstract factory → Xiaomi factory
- Xiaomi factory → Xiaomi products: creates
- Device bridge → OS implementations: installs
- Device bridge → Color implementations: uses
- Logistics proxy → Logistics service: delegates
- Registration chain → Profile handler: starts
- Profile handler → Experience handler: dispatches
- Experience handler → Education handler: dispatches
- Trip strategy → Road strategy: selects
- Trip strategy → Flight strategy: selects