Design Pattern (1) 设计模式(1) Institute of Computer Software 2022-2-27 Nanjing University
设计模式(1) Design Pattern (1) 2022-2-27 Institute of Computer Software Nanjing University 1
&雪扇 摘要 UNIVE 2 Agile Design ▣design principles Design Patterns ▣Why,What,How Creational,Structural and Behavioral Patterns Institute of Computer Software 2022-2-27 Nanjing University
摘要 Agile Design design principles Design Patterns Why, What, How Creational, Structural and Behavioral Patterns 2022-2-27 Institute of Computer Software Nanjing University 2
&扇 NAN Design Principles UNIVE 3 口SRP单一职责原则 口OCP开放-封闭原则 口LSP Liskov(里氏)替换原则 口DP依赖倒置原则 口ISP接口隔离原则 CARP(Composition/Aggregation Reuse Principle 合成/聚合复用原则 口LoD(Law of Demeter)迪米特法则 Institute of Computer Software 2022-2-27 Nanjing University
Design Principles SRP 单一职责原则 OCP 开放-封闭原则 LSP Liskov(里氏)替换原则 DIP 依赖倒置原则 ISP 接口隔离原则 CARP (Composition/Aggregation Reuse Principle ) 合成/聚合复用原则 LoD (Law of Demeter) 迪米特法则 2022-2-27 Institute of Computer Software Nanjing University 3
&扇 NAN CARP 002 UNIVE 4 Composition(合成)vs.Aggregation(聚合) 口聚合表示“拥有”关系或者整体与部分的关系 口合成是一种强得多的“拥有”关系一部分和整体 的生命周期是一样的。 口换句话说:合成是值的聚合(Aggregation by Value),而一般说的聚合是引用的聚合 (Aggregation by Reference) Institute of Computer Software 2022-2-27 Nanjing University
CARP Composition(合成) vs. Aggregation(聚合) 聚合表示“拥有”关系或者整体与部分的关系 合成是一种强得多的“拥有”关系——部分和整体 的生命周期是一样的。 换句话说:合成是值的聚合(Aggregation by Value),而一般说的聚合是引用的聚合 (Aggregation by Reference) 2022-2-27 Institute of Computer Software Nanjing University 4
&扇 复用 5 口复用的基本种类 口合成/聚合复用:将已有对象纳入到新对象中,使 之成为新对象的一部分。 口继承 Institute of Computer Software 2022-2-27 Nanjing University
复用 复用的基本种类 合成/聚合复用:将已有对象纳入到新对象中,使 之成为新对象的一部分。 继承 2022-2-27 Institute of Computer Software Nanjing University 5