Discussing the article: "Design Patterns in software development and MQL5 (part one): Creational Patterns"

 

Check out the new article: Design Patterns in software development and MQL5 (part one): Creational Patterns.

There are methods that can be used to solve many problems that can be repeated. Once understand how to use these methods it can be very helpful to create your software effectively and apply the concept of DRY ((Do not Repeat Yourself). In this context, the topic of Design Patterns will serve very well because they are patterns that provide solutions to well-described and repeated problems.

Classes of the creational pattern use the inheritance concept to vary the class as an instance, while the object of the creational pattern will give the task of instantiation to another object. When the software focuses more on the object composition than the class inheritance that make creational patterns gain more importance.

We can say that Creational patterns have two recurring themes:

  • They use the concept of encapsulation to the knowledge about the concrete classes that can be used by the system.
  • They make the method of creating instances of classes and putting them together hidden.

Creational patterns help to apply flexibility in what to create, who, and how it can be created, in addition to when it is created.

They help also abstract the instantiation process because they allow us to create objects without repeating the same implementation and that helps to make our code more flexible and simple.


Author: Mohamed Abdelmaaboud

 

I thought the translators made a little mistake in the subsection about abstract factory, but no - the author himself.

Какую проблему проектирования он решает?

So, we can use this template when:

  • THERE'S NOTHING
  • We need an independent system.
  • Need a configured system with one of many product families.
  • Need to use a family of related products together as designed and enforce this constraint.
  • Need to expose only the interfaces of the provided class, not their implementation.

Examples of using such an Abstract Factory:

In the English source code it is:

What design problem does it solve?

So, we can use this pattern in the case of the following:

  • We need an independent system.
  • We need a configured system with one of many families of products.
  • We need to use a family of related product objects together as per its design and enforce this constraint.
  • We need to reveal just interfaces of the provided class, not their implementation.


 
Thank you, corrected.
 

I'm going to be a little bit more grumpy...

To be precise in terminology, I will look at the English source of the article. So, the author writes "How can we use it in MQL5?" about each template. It should be noted here that MQL5 is an applied specialised language. So what is it? Do we really learn from the material how to use templates in MQL5? No! We see that we just see the implementation of a template in MQL5. Imho, since it is a template, we should first describe it in pseudocode, and only then in MQL5. Ideally, it would be interesting to see practical examples of using design patterns in MQL5. I don't know, maybe I'm getting ahead of myself and the author plans to consider each template in a separate opus. But for now we have what we have....



Design Patterns in software development and MQL5 (Part I): Creational Patterns
Design Patterns in software development and MQL5 (Part I): Creational Patterns
  • www.mql5.com
There are methods that can be used to solve many problems that can be repeated. Once understand how to use these methods it can be very helpful to create your software effectively and apply the concept of DRY ((Do not Repeat Yourself). In this context, the topic of Design Patterns will serve very well because they are patterns that provide solutions to well-described and repeated problems.
 
Sir, Thank you for your time and willingness to share your knowledge.
As someone who knows MQL and also knows and uses OOP at some degrees, but has no idea about design patterns, I have to say I did not understand what you explained.
I did not read it fully, because whats the point of reading paragraph after paragraph if I didn't understand any of them.
The way I'm going to continue learning from this article would be to stick to your code examples only, and try to understand the concept from that.
I wrote this purely to share a feedback.
Thanks again.