-
Factory Design Pattern
Example UML for Factory Pattern:
-
Abstract Factory Design Pattern
Example UML for Abstract Factory Pattern:
-
- Use this pattern when we want to avoid a permanent binding between an abstraction, and it's implementation. This might be the case, for example, when the implementation must be selected or switched at run-time.
- Both abstractions and their implementations should be extensible by subclassing them independently. We can combine abstractions and implementations and extend them independently.
- Changes in the implementation of an abstraction should have no impact on client; that is, their code should not have to be recompiled.
- We want to share an implementation among multiple objects (perhaps using
reference counting), and this fact should be hidden from the client.
Example UML for Bridge Pattern:
-
- Use this pattern when we want to represent part-whole hierarchies of objects.
- We want clients to be able to ignore the difference between compositions of objects and individual objects. Clients will treat all objects in the composite structure uniformly.
- This pattern is useful when we want to represent structures like hierarchy
(user hierarchy, role hierarchy), file system/directory structure, etc.
Example UML for Composite Pattern:
- Strategy Design Pattern
Example UML for Strategy Pattern:
- Repository Design Pattern
Repository design pattern is used for providing abstraction to the data access logic. Using Repository Design Pattern, the business logic layer of your application need not have any knowledge on how data persistence happens beneath.
Example UML for Repository Pattern: