What OOP code can do that procedural code can't ? - page 4

To add comments, please log in or register
Donald Gibson
488
Donald Gibson  
Doerk Hilger:

Do you really expect someone professional is posting a compex library, just like that as a "proof"? ;) I could post you a link to something ready which cannot be sold at the market here, but Alain is gonna kick me if I did ;) You may visit my profile ans take a look at the wall picture to get an idea or drop me a pm.

Another platform? You will not find any other platform with such a powerful compiler. Not at all.

@James Cater - thanx a lot for your comments. 

There are other platforms out there other than MT, as far as the compiler being more or less powerful I really don't care as long as I can write simple code.

What you are missing here is education, we all are still learning, some are just further down the road than some others. As far as I know this is not a contest, rather a place for the exchange of knowledge and support.

And by the way, I don't believe anyone in this forum will write a million line program. 

Juan Fernandez
2353
Juan Fernandez  
Alain Verleyen:
You missed the point Dirk. Non specialist people want simple and clear code examples, which in fact was my goal with this topic. But that seems completely beyond specialists understanding.

You told the key happens in every language.  Latest languages try simplify the things for people with less knowledge coding can be added to the group of "coders". The best example is pseudo language HTML. And that is the big mistake. When MT5 was developed many "newbies" blame the OOP style because was hard. But the truth is every job have their professionals. If you want improve a platform you have complex it. More features more flexibility. Let people without knowledge coding try do it it's like somebody without knowing in build houses have make one. Will be a disaster.

About length projects depends of coder. My library is medium size for MQL language. Others only need small libraries for create tools. In my case I prefer spend time in create framework for save time and simplify develop in a future. If you have make complex UIs or reuse code for others projects is the smarter way.

Alain Verleyen
39036
Alain Verleyen  
Juan Fernandez:

You told the key happens in every language.  Latest languages try simplify the things for people with less knowledge coding can be added to the group of "coders". The best example is pseudo language HTML. And that is the big mistake. When MT5 was developed many "newbies" blame the OOP style because was hard. But the truth is every job have their professionals. If you want improve a platform you have complex it. More features more flexibility. Let people without knowledge coding try do it it's like somebody without knowing in build houses have make one. Will be a disaster.

About length projects depends of coder. My library is medium size for MQL language. Others only need small libraries for create tools. In my case I prefer spend time in create framework for save time and simplify develop in a future. If you have make complex UIs or reuse code for others projects is the smarter way.

So people can't acquire knowledge ?

Alain Verleyen
39036
Alain Verleyen  

Procedural vs OOP is a useless debate, 3 years ago it was already discussed and my answer is completely valid, nothing more has been said here :

Forum on trading, automated trading systems and testing trading strategies

Programmers: Whats your perference: OOP vs Procedural

Alain Verleyen, 2013.06.11 13:11

Your poll lacks an option for those that prefers nothing. I mean, this is not only a matter of preference, that makes no sense to use OOP for a little script or even an simple EA. OOP always add work and is only advantageous for complex project and code re-usability (same code used in several projects). Complex is not the same is large, if someone has a large project but relatively simple this does not automatically mean that he must use OOP.

You can see the great potential of OOP with MQL5 Wizard developped by Metaquotes, it would be very difficult to develop such a tool with procedural programming, although it is feasible.

OOP should be used :

  • On complex project like stated very well by Doerk and James.
  • When you want to reuse your code.

From now I will not accept any post which is not concrete, without code example to demonstrate why and how OOP should be better used in above cases.

Donald Gibson
488
Donald Gibson  
Alain Verleyen:

Procedural vs OOP is a useless debate, 3 years ago it was already discussed and my answer is completely valid, nothing more has been said here :

OOP should be used :

  • On complex project like stated very well by Doerk and James.
  • When you want to reuse your code.

From now I will not accept any post which is not concrete, without code example to demonstrate why and how OOP should be better used in above cases.

Thank you
Mrluck07
428
Mrluck07  
I read all this topic, and find this interesting, but isn't machine code procedural? So high level languages, and OOP included, all of them in the end are translated in procedural in the compiler, right? If all languages are translated into procedural  machine code, so we can say that everything can be done in procedural, if the programmer get the skills, please someone correct me if i'm wrong
Amir Yacoby
1365
Amir Yacoby  
Mrluck07:
I read all this topic, and find this interesting, but isn't machine code procedural? So high level languages, and OOP included, all of them in the end are translated in procedural in the compiler, right? If all languages are translated into procedural  machine code, so we can say that everything can be done in procedural, if the programmer get the skills, please someone correct me if i'm wrong

Everything can be done in procedural theoretically. It's not practical.
A brick is built out of thousands of thousands of sand particles, so you can build a house without bricks, just from sand.
But no one is even trying when you have bricks.

A Plane is built out of ready made parts - wings, wheels, sits, computers, etc. They are all made out of metal or plastic or glass at the end. But no one will build a plane out of pure glass, plastic and metal.

For the debate in general(in response to Alain and the others): Take the CArrayObj - an array of objects. This alone is enough to answer what is the power of OO (which is far more than this). It can store an array of any objects - like indicators for instance.
And in no effort at all, do complex things for all this different indicators. And if you now want a new power to this, for instance you want to know when an indicator buffer is crossed, you just have to put the method in CIndicator, that's it. And so on. How would you do it in procedural?

And this can be done in all aspects - Strategies, Trades, Deals, Signals - whatever.

Alain Verleyen
39036
Alain Verleyen  
Amir Yacoby:

Everything can be done in procedural theoretically. It's not practical.
A brick is built out of thousands of thousands of sand particles, so you can build a house without bricks, just from sand.
But no one is even trying when you have bricks.

A Plane is built out of ready made parts - wings, wheels, sits, computers, etc. They are all made out of metal or plastic or glass at the end. But no one will build a plane out of pure glass, plastic and metal.

For the debate in general(in response to Alain and the others): Take the CArrayObj - an array of objects. This alone is enough to answer what is the power of OO (which is far more than this). It can store an array of any objects - like indicators for instance.
And in no effort at all, do complex things for all this different indicators. And if you now want a new power to this, for instance you want to know when an indicator buffer is crossed, you just have to put the method in CIndicator, that's it. And so on. How would you do it in procedural?

And this can be done in all aspects - Strategies, Trades, Deals, Signals - whatever.

This topic was intentionally provocative, however the answer to the main question (what can OOP can do that procedural code can't) is NOTHING.

OOP is certainly not the only way to build and use bricks. They are at least as much way to create bad code in OOP than in procedural code (and most probably more ways). Just look at the "Standard library" provided by Metaquotes, which actually is far from "standard".

OOP versus procedural is useless and endless debate. A more useful one should be "How to produce quality code ? With and without OOP, with and without procedural, with and without any programming paradigm". If your needs is to build one wooden house, you don't need bricks, but you need it to be a good, solid and reliable house.

Amir Yacoby
1365
Amir Yacoby  
I know it was provocative Alain.
And good programming can surely be practised every where. But, as every world is built of objects, and that includes the trading world, oo is much more suited to describe this world then procedures. Of course when they both written well.


Mrluck07
428
Mrluck07  
Amir Yacoby:

Everything can be done in procedural theoretically. It's not practical.
A brick is built out of thousands of thousands of sand particles, so you can build a house without bricks, just from sand.
But no one is even trying when you have bricks.

A Plane is built out of ready made parts - wings, wheels, sits, computers, etc. They are all made out of metal or plastic or glass at the end. But no one will build a plane out of pure glass, plastic and metal.

For the debate in general(in response to Alain and the others): Take the CArrayObj - an array of objects. This alone is enough to answer what is the power of OO (which is far more than this). It can store an array of any objects - like indicators for instance.
And in no effort at all, do complex things for all this different indicators. And if you now want a new power to this, for instance you want to know when an indicator buffer is crossed, you just have to put the method in CIndicator, that's it. And so on. How would you do it in procedural?

And this can be done in all aspects - Strategies, Trades, Deals, Signals - whatever.

In your example, when you code OO and click compile, it will generate machine code. But this machine code is procedural or not? I really don't know the answer, someone here does? If machine code is procedural, then you can call OO only a higher level language, that makes easier to code only, but nothing special, so  a skilled C programmer can do the same job that a OO programmer, in fact, it can be even better optimized. So my question, ex code is prodedural or not?


To add comments, please log in or register