Popular posts from this blog
C# | Adapter Design Pattern | Structural Design Pattern
Adapter pattern works as a bridge between two incompatible interfaces. This type of design pattern comes under structural pattern as this pattern combines the capability of two independent interfaces. This pattern involves a single class which is responsible to join functionalities of independent or incompatible interfaces. A real life example could be a case of card reader which acts as an adapter between memory card and a laptop. You plugin the memory card into card reader and card reader into the laptop so that memory card can be read via laptop. We are demonstrating use of Adapter pattern via following example in which an audio player device can play mp3 files only and wants to use an advanced audio player capable of playing vlc and mp4 files. Who is what? The classes, interfaces and objects in the above class diagram can be identified as follows: 1. ITraget - Target interface 2. Employee Adapter - Adapter Class 3. ...
C# | Bridge Design Pattern | Structural Design Pattern
Bridge pattern is used to separate an abstraction from its implementation so that both can be modified independently. This pattern involves an interface which acts as a bridge between the abstraction class and implementer classes and also makes the functionality of implementer class independent from the abstraction class. Both types of classes can be modified without affecting to each other. Bridge Pattern - UML Diagram & Implementation The UML class diagram for the implementation of the bridge design pattern is given below: The classes, interfaces and objects in the above UML class diagram are as follows: 1. Abstraction This is an abstract class and containing members that define an abstract business object and its functionality. It contains a reference to an object of type Bridge. It can also acts as the base class for other abstractions. 2. Redefined Abstraction This is a class which inherits from the Abstraction c...
Comments
Post a Comment