tailieunhanh - Lecture Software design and architecture – Chapter 28

In this chapter, the following content will be discussed: Introduction to design patterns, creational design patterns, structural design patterns, behavioral design patterns, design pattern classifications, structural design pattern, adapter pattern. | SOFTWARE DESIGN AND ARCHITECTURE LECTURE 28 Review Introduction to design patterns Creational Design Patterns Structural Design Patterns Behavioral Design Patterns Outline Design pattern classifications Structural Design Pattern Adapter Pattern GoF Design Patterns GoF Design Patterns The GoF design patterns are “descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context.” Creational Patterns Creational class patterns: defer some part of object creation to subclasses Creational object patterns: defer it to another object. GoF Design Patterns GoF Creational Patterns Abstract Factory Provide an interface for creating families of related or dependent objects without specifying their concrete classes. Builder Separate the construction of a complex object from its representation so that the same construction process can create different representations. Factory Method Define an interface for creating an object, but let . | SOFTWARE DESIGN AND ARCHITECTURE LECTURE 28 Review Introduction to design patterns Creational Design Patterns Structural Design Patterns Behavioral Design Patterns Outline Design pattern classifications Structural Design Pattern Adapter Pattern GoF Design Patterns GoF Design Patterns The GoF design patterns are “descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context.” Creational Patterns Creational class patterns: defer some part of object creation to subclasses Creational object patterns: defer it to another object. GoF Design Patterns GoF Creational Patterns Abstract Factory Provide an interface for creating families of related or dependent objects without specifying their concrete classes. Builder Separate the construction of a complex object from its representation so that the same construction process can create different representations. Factory Method Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses. Prototype Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype. Singleton Ensure a class only has one instance, and provide a global point of access to it. Structural Patterns Structural class patterns: use inheritance to compose classes Structural object patterns: describe ways to assemble objects. GoF Structural Patterns GoF Structural Pattern Adapter Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces. Bridge Decouple an abstraction from its implementation so that the two can vary independently. Composite Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly. GoF Structural Pattern Decorator Attach