This if for a C assignment Please explain a scenariouse case
This if for a C# assignment.
Please explain a scenario/use case(example) of when I can use each of the following design patterns. Does not have to be long but it can not be one online please help!
A) Adapter
B) Briidge
C) Composite
D) Decorator
E) Facade
F) Flyweight
G) Proxy
Solution
Composite pattern is one of the Structural design pattern and is used when we have to represent a part-whole hierarchy.
Example:
A diagram is a structure that consists of Objects such as Circle, Lines, Triangle etc .
Proxy pattern is very clear and proxy pattern is used when we want to provide controlled access of a functionality.
Example:
Let’s say we have a class that can run some command on the system. Now if we are using it, its fine but if we want to give this program to a client application, it can have severe issues because client program can issue command to delete some system files or change some settings that you don’t want.
 Flyweight design pattern is used when we need to create a lot of Objects of a class. Since every object consumes memory space that can be crucial for low memory devices, such as mobile devices or embedded systems, flyweight design pattern can be applied to reduce the load on memory by sharing objects. String Pool implementation in java is one of the best example of Flyweight pattern implementation.
Facade Pattern is used to help client applications to easily interact with the system. Suppose we have an application with set of interfaces to use MySql/Oracle database and to generate different types of reports, such as HTML report, PDF report etc.
Example
we can apply Facade pattern here and provide a wrapper interface on top of the existing interface to help client application.
Bridge design pattern:
The implementation of bridge design pattern follows the notion to prefer Composition over inheritance.
Decorator design pattern is one of the structural design pattern and uses abstract classes or interface with composition to implement.
 Facade Pattern is used to help client applications to easily interact with system
Example
we can apply Facade pattern here and provide a wrapper interface on top of the existing interface to help client application.


