Should metatrader incorporate functional programming?

To add comments, please log in or register
Mrluck07
428
Mrluck07  
First we got imperative, later we get OOP, but the new thing today is functional programming, some say you avoid lots of bugs, and it's very good with large projects, so my question: in this trading field, functional programming can be useful? thanks
Marco vd Heijden
Moderator
13034
Marco vd Heijden  

What difference does it make how you code it?

It needs to be profitable and that is the only requirement.

I don't care if it's oop or spaghetti, or anything else, as long as it does what it was designed for.  

Focus on what matters.

Indanguang Samrow Panmei
365
Indanguang Samrow Panmei  
from a traders perspective,its very true.whethr its c or b or d language,a trader just needs a profitable indicator or EAs
Mrluck07
428
Mrluck07  
Marco vd Heijden:

What difference does it make how you code it?

It needs to be profitable and that is the only requirement.

I don't care if it's oop or spaghetti, or anything else, as long as it does what it was designed for.  

Focus on what matters.

There is a lot of hate going on about OO today, if you use more than 3 layers inside an object, it starts to become exponentially more complicated, you have several multiple states, and the glue between objects become hard to code, in functional programming you can have a more reusable and modular code, even java now is adopting this model. I saw in a page:  "OOP is when you can reuse the bullet after shooting yourself into the knee". In a functional programming language the states are not shared, so each function is independent, and that makes easier to debug. In my opinion the hardest part of coding is debugging

Marco vd Heijden
Moderator
13034
Marco vd Heijden  
Indanguang Samrow Panmei:
from a traders perspective,its very true.whethr its c or b or d language,a trader just needs a profitable indicator or EAs

I am not sure if we should view this from a traders perspective.

Maybe Mr.Luck just want's to become a good programmer, and maybe he does not have the intention to make profits what so ever.

Spec Trance
12
Spec Trance  
I love reading threads like this... because instead of discussing a higher programming concept and how it could maybe benefit the entire community as a whole, we can rather bash each other with concerns over pure profits and show how superior our knowledge and experience is. Why even bother answering a question like this if you are going to answer like this? The original poster had a great question... functional programming has existed since the 57s ... lambda calculus has existed since the 30s... and we decide to answer with a "Who cares for cars, I just need a faster Horse" mentality. Shame!
Spec Trance
12
Spec Trance  
Mrluck07:
First we got imperative, later we get OOP, but the new thing today is functional programming, some say you avoid lots of bugs, and it's very good with large projects, so my question: in this trading field, functional programming can be useful? thanks

If you need to do functional programming in MQL ... my present understanding is that with the current framework it can be simulated...

1. You can create a class with a single method and use it as a lambda function. Something like an inner anonymous class does the same thing despite the unfortunate boilerplate code.

2. Of course there will be no syntactical sugar (although a preprocessor can be written manually if desired but its upto you to implement that, i would only do this if i wanted to commit to it long-term),

3. Nor will there be any automated optimizations under the hood but ...

4. ...you can still get a more declarative style of code (improving readability) and avoiding side effects(by using immutable data structures) which are the core concepts of functional programming.

5. Lastly people who are hating on OOP(or FP) need to understand that any good program will involve attributes of both OOP or FP... What matters is that we need to apply basic programming principles (DRY, YAGNI, SLAP(single level of abstraction), etc) and SOLID principles in any good code regardless of the programming paradigm. 

Regards

To add comments, please log in or register