Questions on OOP in MQL5

 

Yesterday a question came up, so I decided to consult with my brothers)

On Saturday 21.05.2016 I was explaining the basics of OOP to a man, using a standard library as an example. He used to program in MQL4, then had a break for 5 years and decided to come back. I have started to introduce him to MT5 hedging, for I myself re-do everything there.

However strange it may seem, this person (Maxim, I mean you, if you are reading this article :)) has understood the basics of OOP and we have even managed to go through the most important parts using the example of a standard library under the debugger.

But!!! I promised a recording, and for technical reasons it all flew into meow((

I promised that I will make video cheat sheets exactly on OOP, I think, 10 minutes each

Question:

Suggest a topic on OOP in MQL5 for 10 minutes. I will post it on YouTube, it will be useful for everyone

------------------

Write everything that is interesting, I will sort it out, I will try to satisfy your requests within my free time

Good luck ))

 
Alexey Volchanskiy:

Yesterday a question came up, so I decided to consult with my brothers)

On Saturday 21.05.2016 I was explaining the basics of OOP to a man, using a standard library as an example. He used to program in MQL4, then had a break for 5 years and decided to come back. I have started to introduce him to MT5 hedging, for I myself re-do everything there.

Strangely enough, the man (Maxim, I mean you, if you are reading this article :)) has understood the basics of OOP and we have even managed to go through the most important parts using the example of a standard library under the debugger.

But!!! I promised a recording, and for technical reasons it all flew to meow((

I promised that I will make video cheat sheets exactly on OOP, I think, 10 minutes each

Question:

Suggest a topic on OOP in MQL5 for 10 minutes. I will post it on YouTube, it will be useful for everyone

------------------

Write everything that is interesting, I will sort it out, I will try to satisfy your requests within my free time

Good luck ))

Alexey, make examples on the least covered places in help - pointers, function pointers, work with template classes, etc. Although, honestly, in my opinion, such a video on C++ in abundance and it will not increase the knowledge, to increase knowledge you need literature, webinars and diligence.
 
coderex:
Alexey, do examples on the least covered places in the help - pointers, function pointers, working with template classes, etc. Although, frankly speaking, in my opinion, such a video on C++ is abundant and it will not increase the knowledge in any way, you need literature, webinars and diligence to enhance it.
There are no pointers in MQL, there are descriptors) Pointers (conditional) to functions were recently introduced, some kind of crutch to fit the general concept of "all the algo-traders are suicidal, don't give them pointers".
 
Alexey Volchanskiy:
There are no pointers in MQL, there are handles)) Pointers (conditional) to functions were recently introduced, it's a kind of crutch to fit the general concept of "all the algo-traders are suicidal, they mustn't use pointers".

Alexei, don't cling to words :) If I had written "descriptors", for some reason I'm sure you wouldn't immediately understand me. As for what was introduced recently and what was introduced a long time ago, it does not change the essence, these questions on the help are hanging in the air, there is not a word or a little bit about them. And these names, no matter how they may behave differently with regards to C++ and MQL, they all look the same, at least, the developers are trying to do it that way. I've even see that they have already introduced pointer comparison :) Although honestly, for MT I can't imagine where to use it.

But all the same, I think that if you will cover these questions, many novice coders will be grateful to you. I've seen your video the other day; you know how to explain things so clear :)

 
coderex:

Alexei, don't cling to words :) If I had written "descriptors", for some reason I'm sure you wouldn't immediately understand me. As for what was introduced recently and what was introduced a long time ago, it does not change the essence, these questions on the help are hanging in the air, there is not a word or a little bit about them. And these names, no matter how they may behave differently with regards to C++ and MQL, they all look the same, at least, the developers are trying to do it that way. I've even see that they have already introduced pointer comparison :) Although honestly, for MT I can't imagine where to use it.

But all the same, I think that if you will cover these questions, many novice coders will be grateful to you. I once watched your video, you know how to explain people clearly :)

Imho, in no case you should not make an educational video an extended version of help. The aim is to educate, not to illuminate the unworthy details.
 
Alexey Volchanskiy:

Question:

Suggest a topic on OOP in MQL5 for 10 minutes, I'll put it on YouTube, that is, it will be useful for everyone

OOP should be explained without any code and all that abstruse nomenclature like classes, objects, pointers, etc. etc.

How does a classical programming course work? At first, a student is agonizingly trying to move from human thinking to programming basics (loops, functions, variables and other stuff like that needed "knowledge baggage"). Then, when mess of functions, variables and if's forms some more or less orderly structure, the student is told: "Look: there is such a thing as OOP. Forget what you were taught before, and start thinking like a human again". What follows is a rupture of templates, the "baggage of knowledge" just obtained with such difficulty is thrown on the trash heap, and the person finds himself somewhere between heaven and earth. Naturally, this "PLO" is then remembered for several years as a bad dream with shuddering and pain in the remaining parts of the brain (the others have been scorched by the new knowledge).

No, I categorically state that one should not learn programming. On the contrary, it is harmful and dangerous. Instead it is necessary to teach thinking. And with that there is a complete failure in the classical method of learning.

 
Vasiliy Sokolov:
In my opinion, you can by no means make an extended version of Help from a training video. The task is to educate, not to illuminate the unworthy details.

Alexei asked the opinion of forum users, I wrote him my opinion, and what will be there, only Alexei knows :)

By the way, how can one learn if there is no information about it anywhere? I know about it, since I'm writing in C++, and those who are only learning MQL5, won't know about these details, because the reference doesn't say a word about it :)

 
Do you want to learn OOP competently? - Learn UML
 

Vasiliy Sokolov:

Then, when the mess of functions, variables and if's in your head forms some more or less orderly structure, the student is told: "Look: there is such a thing as OOP. Forget what you were taught before, and start thinking like a human again". Then comes the break of templates, the "baggage of knowledge" just obtained with such a great effort is thrown on the trash and the person finds himself somewhere between the earth and heaven.

Well, you are too much. A man has been initially engaged only in OOP. At least, by simply brewing a cup of coffee. Where do the patterns come from? IMHO, the nonsense of unintelligent teachers, shifting their problems to students.
 

Don't scare people with OOP.

You don't need to know OOP to create good EAs or other things in MQL5. You don't even need to know the word class or pointer.

OOP is mostly used to create large tasks and complexes, especially when there is teamwork going on.

And in MQL5 you can do without OOP.

I must add that for more than 10 years I have been involved in training those programmers, who want to work in foreign companies, where the main requirement is knowledge of OOP.

This I say so that you won't think that I am an opponent of OOP. It is just necessary to use it as intended and not to complicate life.

 

Understanding of OOP comes by itself when programs become more complex. The programmer begins to split the code sheet into several functions, there is a need to transfer results of various functions between each other, soon he begins to suspect that transferring everything via function arguments is not the best solution, most likely he will start creating global variables, a person is almost ripe for OOP, the only thing left is to isolate logically related functions and their private data. My experience: back in mcl4 I started creating something like this:

// file_1.mqh
int name1_counter = 0;
int name1_data = 0;
double name1_value = 0;
void name1_action() {name1_counter++; name1_data = ;}
int name1_get() {return }

// file_2.mqh
int name2_counter = 0;
int name2_data = 0;
double name2_value = 0;
void name2_action() {}
int name2_get() {}


I didn't even know about any OOP, but it was almost there (yes, only one instance, but the skeleton was ready). I would walk trainees through these steps. Start with a sheet of int's and if's and gradually structure the code. At the end a person will almost reach the OOP by himself and the main thing is that he will understand how he got there.

I remember reading one book about this "magic" OOP long ago. The book's climax was a demonstration of virtual functions saying that this is the power of OOP. I should tear off the hands of such authors. I haven't come across any decent book so far.

Reason: