OOP vs procedural programming - page 8

 
Dmitry Fedoseev:

Maybe it's not a rational approach to load all open orders with all their parameters into an array.


Perhaps, if I need two parameters profit and stop loss in my code, it is too expensive to run the loop twice.

This is a universal code and we can cut out unnecessary things to speed up the final process...

 
Vladimir Pastushak:

Simplify

That's why I can't stand OOP. It's impossible to understand anything. There's no commentary. What is required to be done in the end?
 
Реter Konow:
That's why I can't stand OOP. It's impossible to understand anything. No commentary. What is required to be done in the end?

Why don't you just start learning it?

 
Реter Konow:
That's why I hate OOP. It's impossible to understand anything. No comments. What is required to be done in the end?

That's the thing: you don't understand, but you have an array structure with all the orders and easy to call anywhere. And you only run the heavy loop once...

 
Dmitry Fedoseev:

Why don't you just start learning it?

Fills an array with function values in a loop. The question is, why do you need a class shell? You can get by with a function.
 
Реter Konow:
Fills the array with function values in the loop. The question is, why do you need a class shell? You can do with a function.

The fewer function calls, the faster the code.

 
Реter Konow:
Filling the array with function values in the loop. The question is, why do you need a class shell? You can do with a function as well.

The structure is very convenient - no need to pile arrays and resize them individually. This example does not show the advantages of OOP, just that everyone does it the way he/she is personally comfortable.

 
Vladimir Pastushak:

That's the thing: you don't understand, but you have an array structure with all the orders and easy to call anywhere. At the same time you only run the heavy loop once...

I understand why I don't understand it, it's not my code, and it's only a part of it. But you don't seem to understand it either - or am I wrong?
 
Dmitry Fedoseev:

Gentlemen arguers, let's put it this way, if you don't understand OOP, don't know, then let's argue not procedural programming vs. OOP, but procedural programming with pointers to functions vs. procedural programming without pointers to functions.

No your example is very good.

It's not about procedural programming.

There is a much more important criterion of program quality: code clearness.

The solution you've given is awful: it is not at all clear WHAT function is called meaningfully. I would write a normal switch and a comment against each call. This is the right code.

From your example I conclude that OOP is a harmful thing.

 
Vladimir Pastushak:

The fewer function calls, the faster the code.

That's why I like to make large, generic blocks of code.
Reason: