You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I understand why I don't understand it, it's not my code, besides it's only a part of it. But you don't seem to understand it either - or am I wrong?
I don't use pointers...
Earlier I worked in the same way as you, only with functions, but with time they had to be stored somehow, then I had to search for them, each function did its own extra actions.
Now I've rebuilt everything into classes and when I call Order class I get everything I need and a list of available functions and methods...
That's why I like to make big generic blocks of code.
Can't even believe the author of a good GUI without OOP
Saving lines of code?!
No, your example is very good.
It's not about procedural programming.
There is a much more important criterion of program quality: code clarity.
The solution you've given is awful: it is not at all clear WHAT function is being called in a meaningful way. I would write a normal switch and a comment against each call. This is the right code.
I conclude from your example that OOP is a harmful thing.
And why switch for 100 variants if you know in advance that only 1 will be used?
What's the sense of a sprawl of 100 variants of switch compared to three lines of code?
It is not right to make complex, large and slow-moving what can be done rationally, optimally (even perfectly).
OOP is harmful only if you use it incorrectly.
Please respond to this comment.
That's why I like to make large, universal blocks of code.
What makes them universal?
Why do you need a 100-variant switch when you know in advance that only 1 will be used?
What is the clarity of a 100-variant switch compared to three lines of code?
Making complex, large and slow things which can be done rationally, optimally (even perfectly) is not the right approach.
Please respond to this comment.
It's not a spoiler - it's a documentation of the program's functionality combined with the program's text. This is the most important thing, not what will work alone
I don't use pointers...
Earlier I worked in the same way as you, only with functions, but with time they had to be stored somehow, then I had to search for them, each function did its own extra actions.
Now I rebuilt everything into classes and when I call Order class I get everything I need and a list of available functions and methods...
This is not a spoiler - it is documentation of the programme's functionality combined with the programme's text. This is the most important thing, not what will work alone
Both the slop and the ballast. The flies should be separate, the cutlets separate. Documentation is important, but it should not interfere with the operation of the program.
What makes them universal?
For example, you need a block that positions graphical objects relative to each other by creating controls. At the same time, the same block controls the phenomenon of objects, i.e. it hides some objects and reveals others. It also calculates scrollbar dimensions and overall window dimensions. It also calculates the slider movement in the scroll bar. This is the universal block of object relationships.
Or a block that controls the size of the window when the window handle is gripped. Or a block that controls the states of controls. Or the block which calculates which element the cursor is on and simultaneously brings many global parameters into focus...
For example, you need a block that positions graphical objects relative to each other by creating controls. At the same time, the same block controls the phenomenon of objects, i.e. it hides some objects and reveals others. It also calculates scrollbar dimensions and overall window dimensions. It also calculates the slider movement in the scroll bar. This is the universal object relationship block.
But this is implemented through if and switch, isn't it?
But this is implemented through if and switch, isn't it?