【每日阅读】2020年4月20日-设计模式在外卖营销业务中的实践

链接

https://tech.meituan.com/2020/03/19/design-pattern-practice-in-marketing.html

文章截图

简评

这篇文章主要讲了工厂模式、策略模式、状态模式、责任链模式在美团业务中的使用,又帮助我回想起了很久很久前看的设计模式知识。有一点感触就是真的很久没有在写代码的时候考虑设计模式了,看了这种文章后,有一种蠢蠢欲动想立马在下一个需求上就用起来的想法。

这篇文章从设计模式的七个原则开始,其实只要记住这七个原则,写出的代码肯定不差。

  • 开闭原则(Open Closed Principle,OCP)
  • 单一职责原则(Single Responsibility Principle, SRP)
  • 里氏代换原则(Liskov Substitution Principle,LSP)
  • 依赖倒转原则(Dependency Inversion Principle,DIP)
  • 接口隔离原则(Interface Segregation Principle,ISP)
  • 合成/聚合复用原则(Composite/Aggregate Reuse Principle,CARP)
  • 最少知识原则(Least Knowledge Principle,LKP)或者迪米特法则(Law of Demeter,LOD)

原创文章,作者:geekgao,如若转载,请注明出处:https://www.geekgao.cn/archives/1458

(0)
geekgaogeekgao博主
上一篇 2020年4月20日 上午1:12
下一篇 2020年4月21日

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

GitHub
分享本页
返回顶部

Warning: error_log(/usr/local/lighthouse/softwares/wordpress/wp-content/plugins/spider-analyser/#log/log-2718.txt): failed to open stream: No such file or directory in /usr/local/lighthouse/softwares/wordpress/wp-content/plugins/spider-analyser/spider.class.php on line 2900