目录
相关文章:
23种设计模式
创建型模式:
- 单例模式 Singleton Pattern
- 建造者模式 Builder Pattern
- 工厂方法模式 Factory Pattern
- 简单工厂模式 Simple Factory Pattern
- 抽象工厂模式 Abstract Factory Pattern
- 原型模式 Prototype Pattern
行为型模式:
- 策略模式 Strategy Pattern
- 状态模式 State Pattern
- 责任链模式 Chain of Responsibility Pattern
- 观察者模式 Observer Pattern
- 模板方法模式 Template Method Pattern
- 迭代器模式 Iterator Pattern
- 备忘录模式 Memento Pattern
- 访问者模式 Visitor Pattern
- 中介者模式 Mediator Pattern
- 解释器模式 Interpreter Pattern
- 命令模式 Command Pattern
结构型模式:
- 代理模式 Proxy pattern
- 组合模式 Composite Pattern
- 适配器模式 Adapter Pattern
- 装饰者模式 Decorator Pattern
- 享元模式 Flyweight Pattern
- 外观模式 Facade Pattern 门面模式
- 桥接模式 Bridge Pattern
阿里招聘面试题:
你能手写一个单例设计模式吗?分析一下它是怎么样工作的。
你能熟练使用那些设计模式?并分析一下。
设计模式的重要性?
垃圾代码特征:
业务代码与技术代码(网络请求、图片加载等功能性代码)耦合;
主业务和增值业务代码职责耦合;
多余的依赖关系;
垃圾袋吗清理工作的设计原则是什么?
单一职责原则:一个类或者一个借口只负责唯一项职责,尽量设计出功能单一的接口;