bridge

package
v0.0.0-...-bd8c593 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2020 License: MIT Imports: 1 Imported by: 0

README

什么是桥接模式?

桥接模式又名桥梁模式,定义是:将抽象和实现解耦,让它们可以独立变化。通过组合的方式替代继承关系,避免继承层次的指数爆炸。

可以解决什么问题?

拆解一个逻辑复杂的类型,让拆解后的各自小类各自迭代,只要组合小类的功能即可。

实现方式是什么?

拆解

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MsgSender

type MsgSender interface {
	// contains filtered or unexported methods
}

演示一个发送根据事件级别发送通知的功能。本来整个逻辑可以合在一起实现,但是为了后续迭代各自演进,可以把发送通知和不同事件级别处理的类分开实现。

type NormalNotification

type NormalNotification struct {
	// contains filtered or unexported fields
}

通过组合的方式是实现

type Notification

type Notification interface {
	// contains filtered or unexported methods
}

type TeleMsgSender

type TeleMsgSender struct{}

type UrgencyNotification

type UrgencyNotification struct {
	// contains filtered or unexported fields
}

type WechatSender

type WechatSender struct{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL