PLO - page 4

 
mrProF:

My mistake-"There is no task that can be written in OOP and cannot be written without OOP".


That's how I understood it for some reason.
 
Try to implement lists, trees, graphs in MQL4. This is not possible. In MQL5 it is easy to do; you don't even have to reinvent the wheel, you can find code in С++ and use it with minimal reworks. And of course, the types I mentioned as an example are better designed as classes. Neural networks, fuzzy logic and many other things can be implemented in MQL5 now. But there is no doubt that each tool should be suitable for the task to be solved, and OOP should be used only when necessary. The shouts of those who berate new features are ridiculous. If you do not like it, do not use it, no one is forcing you to use it. Use functional programming.
 
FoxRex:
Try to implement lists, trees, graphs in MQL4. This is not possible. In MQL5 it is easy to do, you don't even have to reinvent the wheel, just find some code in С++ and use it with minimal reworks. And of course, the types I mentioned as an example are better designed as classes. Neural networks, fuzzy logic and many other things can be implemented in MQL5 now. But there is no doubt that each tool should be suitable for the task to be solved, and OOP should be used only when necessary. The shouts of those who berate new features are ridiculous. If you do not like it, do not use it, no one is forcing you to use it. Use functional programming.

Don't confuse "impossible" and "difficult", there is no task which cannot be solved by procedural programming and which at the same time can be solved by OOP, I mean the final functionality of the program...
And in general, you can write in assembly language, you can relax, serve ready-made :)

OOP is based on the same procedural programming with added isolation of data and functions.
For example it takes longer to write a program "Hello world!" using OOP, but it is faster to write a large project. The line between the choice to write OOP or not OOP is very blurred and depends on the programmer's experience, goals and preferences.
Personally for me it's more convenient to write OOP in most cases, because I know its "bottlenecks" and "widths" and have experience in OOP programming (C++, JavaScript, PHP).
But if I write some short test script, I don't use OOP.

Advice: before you switch to OOP in real-world problems, you should practice on simple examples, for example, to write a class that will add two numbers, etc.
It is unlikely that you can read in a book about OOP and start programming serious programs in it without practice.
You have to get used to it, start thinking in terms of OOP, see what you have to design as a class and what you don't have to.

 
Lists, trees, graphs, it is not possible to have pointers in MQL4.
 
FoxRex:
Lists, trees, graphs, it is not possible to have pointers in MQL4.

Note that this is an implementation, not a result.
Are we programming for the result (program) or for the implementation of the program?
We can do without all these methods and organize it on arrays and value passing.
It is complicated, time consuming, but possible.

 
mrProF:

Note that this is an implementation, not a result.
Are we programming for the result (program) or for the implementation of the program?
You can do without all these methods and arrange them on arrays and value passing.
It is complicated, time consuming, but possible.

Those "born" in the age of Windows and OOP cannot understand DOS and C / Turbo Pascal (not to mention Asm)...

IMHO of course, but....

 
Interesting:

Those who were "born" in the age of Windows and OOP cannot understand what DOS and C / Turbo Pascal (not to mention Asm) are...

IMHO of course, but....

For crackers to understand what asm is :)
You have to try everything for a change, because the programmer can solve a problem in several ways at once :)
But debugging a program in Asm is depressing :)
 
mrProF:

Note this is the implementation, not the outcome.
Are we programming for the result (the program) or for the implementation of the program?
It is possible to do without all these methods and organize on arrays and value passing.
It is complicated, time consuming, but possible.

I agree that we may actually do it, provided that the array is dynamic. But you agree that this is not a very elegant solution. It's easier to do this in assembler. And the OPP was born before Windows. And his ideas helped me to program in assembly language for MS/CT. And my first programming textbook was a three volume book by Knuth.
 
FoxRex:
I agree, it can be done, provided the array is dynamic. But you must agree that it's not a very elegant solution. It's easier to do in assembler. But OPP was born before Windows. And his ideas helped me to program in assembly language for MS/CT. And my first programming textbook was Knuth's three volume book.
I agree.
So, come to think of it - "OOP is convenient" :)

And also: "If you're not comfortable using OOP, don't use it" :)

Two simple concepts...

 
mrProF:

OOP is a good thing for large programs.
If the code is less than 50 lines, you don't need OOP.
But when the code becomes very large, it is almost impossible to understand what belongs to what, only through comments.
The probability of an error increases when variables are not shared as intended; it's a mess.
In OOP, variables can be stored inside a container (class) along with methods (functions).

There is no task that can be written in OOP and cannot be written without OOP.
It is a matter of convenience))

OOP is not a method of solving problems, but a way of code structuring.

You need to use O OP if the program becomes larger than "Hello word".

In general, I've known MQL4 for several years and I cannot stop being amazed at its wretchedness. The fourth MQL is as far away as a star from the capabilities of classical C. In MQL5 the developers decided to go forward. The number of features has increased and programming has become easier. The language has become more complex, yes, but the product was not created for school students.