Appearance mode
- Provides a high-level interface for a group of interfaces in the subsystem
- User uses this high-level interface
Example
- Go to the hospital to see a doctor, the receptionist goes to register, outpatient, price, and medicine
UML class diagram
Scenes
function bindEvent(elem, type, selector, fn) {
if (fn == null) {
fn = selector
selector = null
}
// ****
}
// 调用
bindEvent(elem, 'click', '#div1', fn)
bindEvent(elem, 'click', fn)
Design principle verification
- It does not conform to the single responsibility principle and the open and closed principle, so use it with caution and not abuse.