定义 LSP由Barbara Liskov于1987年提出,一般有两种定义方式: 第一种:If for each object O1 of type S there is an object O2 fo type T such that for all programs P defined in terms of T, the behavior of P is unchanged when
文章正文 2017年1月20日注定是一个会在历史上留下记录的日子,美国第45任总统Donald Trump宣誓就职。他的就职宣誓词非常简短: I do solemnly swear that I will faithfully execute the office of President of the United States, and will to the best of my
SOLID 原则是面向对象设计(OOD)中的一组核心概念,旨在促进软件的可维护性、灵活性和可扩展性。下面为每个原则提供一个简单的代码示例来阐明其意义和应用方式。 S:单一职责原则(Single Responsibility Principle) 单一职责原则指一类应该只有一个改变的理由,即该类只负责一件事。 示例:一个日志记录类,仅负责日志记录功能。 class Logger:def lo