PLO - page 7

 
falkov:

In my opinion, you are very much mistaken!

Once you have big projects (at least several thousand lines of code), you will see that programming with classes (OOP) makes it very easy to control the development process and, most importantly, the debugging process.

Besides, OOP makes projects closer to real life, in fact in real life we deal just with instances of objects (a house, a tree, a man, a car, an order, etc.), i.e. with a set of properties and methods :)

Try to do something in OOP, you will see, that it is more elegant and clear. It is easier than procedural programming!

+1
 

MoneyJinn:

Use the usual procedural programming in MetaTrader 5.

OOP is a development of procedural programming.

After all, no one disputes that you can do without functions. In fact, it is even faster, up to a point. It does not matter that there are code fragments, which perform one and the same action with different data. It's very easy to make a copy.

Repeated use of functions loses out to OOP. Extension of functionality is always creation of a new function and rework of the code to make it possible to call this function depending on different conditions. In a properly written OOP program, an extension is a simple thing that does not require redoing the whole code.

If while writing programs without OOP you don't get discomfort from scaling problems, abundance of unnecessary data and hundreds of functions, random overlapping of variables and necessity of "hot" substitution of functionality, you don't need OOP.

Yes, you should not write in OOP for the sake of OOP, nothing good will come out. You shouldn't replace functions with classes. Avoid anti-patterns

Антипаттерн — Википедия
  • ru.wikipedia.org
Анти-паттерны (anti-patterns), также известные как ловушки (pitfalls) — это классы наиболее часто внедряемых плохих решений проблем. Они изучаются, как категория, в случае когда их хотят избежать в будущем, и некоторые отдельные случаи их могут быть распознаны при изучении неработающих систем. Концепция также прекрасно подходит к...
 
MoneyJinn:

OOP is a bug, like "Niva" or "Lada".

Use regular procedural programming in MetaTrader 5.

It is as accessible here as it is in MetaTrader 4.

Too bad MetaQuotes doesn't emphasize it.

What a load of nonsense. If I were you, I would delete my post, so as not to embarrass myself...
 
Vigor:

OOP is a development of procedural programming.

If when writing programs without OOP you don't have discomfort with scaling problems, abundance of extra data and hundreds of functions, accidentally overlapping variables, need for "hot swapping" of functionality, then you don't need OOP.

Yes, you should not write in OOP for the sake of OOP, nothing good will come out. You don't need to replace functions with classes.

I agree to 100%.

I agree 100%:

Besides, OOP makes projects closer to real life, because in real life we deal just with instances of objects (house, tree, person, machine, order, etc.), i.e. with a set of properties and methods :)

Which is closer to reality: a virtual house, a tree, a person or seeing the program in the sequence in which it is actually executed by the processor?

It is a religious question. And everyone has his own choice.

AlexSTAL:

My post was an answer to a question of a blocked topicstarter who ended up paying for his dislike of OOP,

And also as an answer for common traders who try to master a product like MT5 or switch to MT5 from MT4.

 
MoneyJinn:

My post was a response to a question of a blocked topicstarter who ended up paying the price for his dislike of OOP,

A checklist for the topicstarter:

Object-oriented programming is (read the phrase backwards) object-oriented programming. Or, object-based programming.

By object we mean program code (usually isolated from other code), which describesparameters and behavior of real objects (for example "machine") or fictional objects (for example "grail poopkin"). Each object can have a life of its own and can stew in its own juices. A limited set of "nerve channels" is used to communicate with the outside world - like special functions with external access.

In my opinion, the main advantage of OOP is that the object code can be debugged independently from other code. And then you can assemble, like a mosaic, more complex objects. For example, a "woman" object might include other objects: "fuselage", "landing gear", "tanks", "cockpit", etc.

The MQL5 Wizard is a good example of MQL OOP. It allows you to assemble the Expert Advisor from ready-made objects. And these objects can be combined.

The most tragic argument in favor of the OOP: those who have understood its essence, get hooked on it. It's just easier to program; the code is clearer and more structured.

Мастер MQL5: Создание эксперта без программирования
Мастер MQL5: Создание эксперта без программирования
  • 2010.12.15
  • MetaQuotes Software Corp.
  • www.mql5.com
Вы хотите быстро проверить торговую идею, не тратя времени на программирование? Выберите в "Мастере MQL5" нужный тип торговых сигналов, подключите модули сопровождения позиций и управления капиталом - на этом вся работа закончена. Создайте свои реализации модулей или закажите их через сервис "Работа" - и комбинируйте новые модули с уже существующими.
 
Lizar:
...

The most damning argument in favour of OOP: those who understand it get hooked on it. It is simply easier to program, the code is more understandable and more structured.

That's true, until I mastered OOP it seemed to me that it's such rubbish, that it's not even worth mixing in.

Once I understood it, everything became clear, I don't need to invent unique variable names anymore,

You don't have to create unique names for variables, you don't have to create unique names for i and j counters and you don't have to search through thousands of times code to find out where this variable isn't nulled. :o), and most importantly, everything is right in front of your eyes - when you open the program, everything is instantly clear, here is the object call, here is the interaction of objects, if you want to understand what the object is doing, you go to the object code ...

 
Urain:

That's true, until I mastered OOP it seemed to me that it was such bullshit that it wasn't even worth getting into it.

As soon as I understood it, I got rid of everything, I don't need to invent unique variable names anymore,

You don't need to create unique names for variables, you don't need to create unique names for i and j counters and you don't have to search through thousands of code to find out where this variable isn't nulled. :o), and most importantly, all is plain as the palm of your hand, when you open the program, everything is instantly understandable, here's the call of the object, here is the interaction of objects, if you want to understand what the object does, you go to the object code

+10

I would even argue with the statement that there is no need to use OOP for small projects.

It seems to me that OOP should be used wherever possible - the code lengthens up just a little, but its transparency increases many times over.

 
falkov:

+10

I would even argue with the thesis that for small projects there is no need to use OOP.

It seems to me that OOP should be shoved wherever possible - the code lengthens insignificantly, but its transparency increases many times over.


By the way, here 's a very simple example of when using OOP in a miniscule project can lead to additional convenience.
 

I am an OOP supporter as I have understood the convenience of programming from the bottom up. From interfaces of object interaction to implementation of classes. All those who start with class implementation are not writing in proper OOP, they are writing functional wrappers. Such wrappers provide nothing but a convenient namespace for variables and functions. This is the usual library approach. But even this minimum suits some people and they proudly say "I write in OOP", which is their right, though.

There are skilled programmers and founders of entire currents in modern software who have enough experience to criticize the OOP paradigm. This is an old topic and, in principle, everything has been discussed to the smallest detail long ago, when and where what is lost:

http://blogerator.ru/page/oop_why-objects-have-failed

Here is the answer from OOP supporters

http://bugtraq.ru/library/programming/objectshavenotfailed.html

Классика ООП - Почему объектно-ориентированное программирование провалилось? [MUST READ]
Классика ООП - Почему объектно-ориентированное программирование провалилось? [MUST READ]
  • blogerator.org
Прошло ровно 10 лет с публикации известной и классической в мире программирования статьи, написанной Ричардом Гэбриелом, название которой стало уже нарицательным и вынесено в заголовок моей заметки. Его статья стала настолько острой и злободневной для своего времени, что вызвала бурный всплеск обсуждений в сообществе программистов, целый ряд...
 

C++ speed comparison (small test) Object-oriented and procedural programming (+ different compilers)

https://www.mql5.com/ru/forum/132434/page3

Практические эксперименты на скорость(тесты, исходники, ссылки), на разных языках программирования выкладываем, сравниваем, делаем выводы - MQL4 форум
  • www.mql5.com
Практические эксперименты на скорость(тесты, исходники, ссылки), на разных языках программирования выкладываем, сравниваем, делаем выводы - MQL4 форум