130 likes | 264 Vues
Design patterns are general reusable solutions that address common problems in software design. They serve as templates or descriptions for effectively solving various challenges across different situations. Major patterns are categorized into three groups: Creational (e.g., Singleton, Factory Method), Structural (e.g., Adapter, Composite), and Behavioral (e.g., Observer, Strategy). These patterns help programmers create more flexible and maintainable code by favoring design principles such as programming to an interface and utilizing object composition over class inheritance.
E N D
What are design patterns? A general reusable solution to a commonly occurring problem. A description or template for how to solve a problem that can be used in many different situations.
Words to live by Program to an interface, not an implementation. Favor object composition over class inheritance. Interfaces: good Inheritance: bad
Types of design patterns • Creational • Instantiation of objects • Structural • Class and object composition • Behavioral • Communication between objects
Creational patterns • Abstract Factory • Builder • Factory Method • Prototype • Singleton
Creational patterns • Abstract Factory • Builder • Factory Method • Prototype • Singleton
Structural patterns • Adapter • Bridge • Composite • Decorator • Façade • Flyweight • Proxy
Structural patterns • Adapter • Bridge • Composite • Decorator • Façade • Flyweight • Proxy
Chain of responsibility Command Interpreter Iterator Mediator Memento Observer State Strategy Template method Visitor Behavioral patterns
Chain of responsibility Command Interpreter Iterator Mediator Memento Observer State Strategy Template method Visitor Behavioral patterns
And this affects me how? • What are design patterns used for? • What are the three categories of GoF design patterns? • Patterns you should be able to describe • Singleton • Composite • Façade • Chain-of-responsibility • Observer