Design pattern (I) - overview of design pattern

Do spring breeze in the afterlife 2022-01-26 18:22:26 阅读数:642

design pattern overview design pattern

One 、 The background of software design pattern

        “ Design patterns ” It didn't first appear in software design , It's used in the design of architecture .

        《 Design patterns : The foundation of reusable object-oriented software 》, It's included in this book 23 Design patterns .4 The authors are known for their group of four in the field of software development (Gang of Four,GoF).

Two 、 The concept of software design pattern

        Software design pattern , Also called design pattern , It's a set that's been used over and over again 、 Most people know 、 After the classification cataloging code design experience summary . It describes some recurring problems in the software design process , And the solution to this problem .

3、 ... and 、 Design pattern classification

1. Create pattern :

        Used to describe “ How to create an object ”, Its main feature is “  Separate the creation and use of objects  ”.GoF The book provides Single case 、 Prototype 、 Factory method 、 Abstract factory 、 builder  5 Creation mode .

2. Structural mode :

        Used to describe how to Form a larger structure of classes or objects according to some layout ,GoF The book provides agent 、 The bridge 、 decorate 、 appearance 、 Enjoying yuan 、 Combine 7 A structural pattern .

3. Behavioral patterns :

        Used to describe How do classes or objects cooperate with each other to complete tasks that a single object cannot complete alone , And how to assign responsibilities .GoF The book provides Template method 、 Strategy 、 command 、 Responsibility chain 、 state 、 The observer 、 Intermediary 、 iterator 、 The visitor 、 Memorandum 、 Interpreter 11 Behavioral patterns .

copyright:author[Do spring breeze in the afterlife],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/01/202201261822241837.html