An Introduction Flashcards
Design Patterns
A design pattern is a well-described solution to a common software problem.
Benefits of using Design Patterns
- Design Patterns are already defined and provides industry standard approach to solve a recurring problem, so it saves time if we sensibly use the design pattern. 2. Using design patterns promotes reusability that leads to more robust and highly maintainable code. It helps in reducing total cost of ownership (TCO) of the software product. 3. Since design patterns are already defined, it makes our code easy to understand and debug. It leads to faster development and new members of team understand it easily.
Three Catagories of Java Design Patters
creational, structural, and behavioral design patterns.
Creational Design Patterns
Creational design patterns provide solution to instantiate an object in the best possible way for specific situations. The basic form of object creation could result in design problems or add unwanted complexity to the design. Creational design patterns solve this problem by controlling the object creation by different ways.
Five Examples of Creational Design Patterns
- Singleton Pattern 2. Factory Pattern 3. Abstract Factory Pattern 4. Builder Pattern 5. Prototype Pattern
Structural Design Patterns
Structural patterns provide different ways to create a class structure, for example using inheritance and composition to create a large object from small objects
Seven Examples of Structural Design Patterns
- Adapter Design Pattern 2. Composite Pattern 3. Proxy Pattern 4. Flyweight Pattern 5. Facade Pattern 6. Bridge Pattern 7. Decorator Pattern
Behavioral Design Patterns
Behavioral patterns provide solution for the better interaction between objects and how to provide lose coupling and flexibility to extend easily.
Examples of Design Patterns
- Template Method Pattern 2. Mediator Pattern 3. Chain of Responsibility 4. Observer Pattern 5. Strategy Pattern 6. Command Pattern 7. State Pattern 8. Visitor Pattern 9. Interpreter Pattern 10. Iterator Pattern 11. Memento Pattern