System analysis of java23 design patterns


1 Overview


1.1 Introduction

​ Software design pattern (Design pattern), also known as design pattern, is a set of code design experience that has been used repeatedly and is known to most people. The use of design patterns is for reusable code, making it easier for others to understand, ensuring code reliability, and program reusability.


1.2, advantages

		* 可以提高程序员的思维能力,编程能力和设计能力。
		* 使程序设计更加标准化、代码编制更加工厂化,使软件开发效率大大提高,从而缩短软件的开发周期。
		* 使设计的代码可重用性高,可读性高,可靠性高,灵活性好,可维护性强。


1.3 Three categories

Creation mode
  • Singleton mode
  • Factory method pattern
  • Abstract factory pattern
  • Builder mode
  • Prototype mode
Structural model
  • Adapter mode
  • Decorative pattern
  • Agency model
  • Appearance mode
  • Bridge mode
  • Combination mode
  • Flyweight model
Behavioral model
  • Strategy mode
  • Template method pattern
  • Observer mode
  • Iterative subpattern
  • Chain of Responsibility Model
  • Command mode
  • Memo mode
  • State mode
  • Visitor mode
  • Intermediary model
  • Interpreter mode



1.4 Seven Principles of OOP

  • The principle of opening and closing : open to expansion, and closed to modification. (That is, only expand, not modify.)
  • Richter substitution principle : where the base class appears, subclasses can also appear.
  • Depend on the principle of inversion : Really oriented to abstract programming, rather than relying on concrete.
  • Single responsibility principle : Control the granularity of classes, decouple objects, and improve cohesion.
  • Interface isolation principle : Multiple isolated interfaces are better than a single interface.
  • Dimit's Law : Know the principle at least, one class interacts with other classes as little as possible.
  • The principle of composition reuse : try to use composition/aggregation instead of inheritance.




2. Corresponding blog link

Guess you like

Origin blog.csdn.net/qq_44972847/article/details/108057904