Discussing the article: "Design Patterns in software development and MQL5 (Part 2): Structural Patterns"

 

Check out the new article: Design Patterns in software development and MQL5 (Part 2): Structural Patterns.

In this article, we will continue our articles about Design Patterns after learning how much this topic is more important for us as developers to develop extendable, reliable applications not only by the MQL5 programming language but others as well. We will learn about another type of Design Patterns which is the structural one to learn how to design systems by using what we have as classes to form larger structures.

Bridge pattern can be used when we have an abstraction that has many possible implementations and instead of using the usual method of inheritance which links the implementation to the abstraction always we can use this pattern to decouple the abstraction from its implementations to avoid any issues in case of changes or updates. This can be very useful to create a clean code that can be reusable, extendable, and easily tested.

The following is a graph for the Bridge design pattern:

Bridge

As we can see through the previous graph for the Bridge pattern structure we have the following participants:

  • Abstraction: that defines an interface of the abstraction and maintains a reference to implementor type object.
  • RefinedAbstraction: that extends the abstraction interface.
  • Implementor: that identifies implementation classes interface.
  • ConcreteImplementor: that implements the interface of the implementor and identifies the concrete implementation of this interface.

Author: Mohamed Abdelmaaboud

Reason: