The EOP for schoolchildren. - page 7

 

Don't be mystified, or else, Peter, I will petition you to join the club.

The relevance of encapsulation and OOP arises already when two functions work with one common variable.

 
Dmitry Fedoseev:

Don't be mystified, or else, Peter, I will petition you to join the club.

The relevance of encapsulation and OOP arises already when two functions work with one common variable.

No. If you have two functions working with one variable, declare it global. Or pass it from one to the other. This is not the reason for multiplying the entities.

And what kind of OOP is this on three classes and two structures? Why do we need such short chains of inheritance? Simple solution gets complicated syntax and set of optional syntax techniques. Then, followers start crushing the functionality to justify the relevance of OOP. From the solution's point of view this is wrong.

The application of OOP must be justified by:

1. The desire to learn.

2. To attach your solution to large programs or libraries.

3. A global idea leading to the growth and complexity of the programme and the diversity of its data.

If this is not the case and the solution does not require it, there is no need to use it.

 
Реter Konow:

No. If you have two functions working with the same variable, declare it global. Either pass it from one to the other. This is not the reason to create new entities.

...

That's exactly YES! So as not to turn the code into a homogeneous mess.
 
Dmitry Fedoseev:
That's exactly right! So as not to turn the code into a homogeneous mess.
Comments and a styliser will help.
 
Реter Konow:
Comments and a stylist would help.

Yeah. Also a notebook and permanent make-up on his forehead.

 

This is a question:

If the indicator calculations are implemented as a class, will it have some benefit? When writing the Expert Advisor, it will allow to avoid calling the indicator handle and receive values on the last bar simply by connecting the library with this class.

The indicator may be written referring to this library.

What do you think?

 
Alexey Viktorov:

This is a question:

If the indicator calculations are implemented as a class, will it have some benefit? When writing the Expert Advisor, it will allow to avoid calling the indicator handle and receive values on the last bar simply by connecting the library with this class.

The indicator may be written referring to this library.

What do you think?

Include > Indicators
Have a look, there are examples of indicators on classes.

 
Roman:

Include > Indicators
Look there, there are examples of indicators on classes.

There are examples, so what? The mere existence of these examples does not answer the questions posed by @Alexey Viktorov.

 
Alexey Viktorov:

This is a question:

If the indicator's calculations are formatted as a class, would it be of any benefit?

Yes, we will. At least, in terms of connection to the Expert Advisor. This indicator is included in the code as a single line. And we don't need any iCustom.

 
Ihor Herasko:

It's a must. At least in terms of connection to the EA. Such an indicator is included in the code in one line. And there is no need in iCustom.

Can you provide an example?