Question about code reusability, using including vs library

 

Hi, i have a question, i used to place all the code in the same mq4 file, all together, but as soon the code became to big, i needed to separate it, to organize it better, so it becomes better to reuse the code in other projects.

I see i can use include files and libraries, so my question:

is better to use include or libraries to organize it?

I have another question, about reusability of the code, i use functions to reuse the code, i place basically all EA work in functions, and i can only code in procedural, my question is: if i learn OOP it is better to reuse the code or there is no advantage compared to using functions?

 
Mrluck07:

Hi, i have a question, i used to place all the code in the same mq4 file, all together, but as soon the code became to big, i needed to separate it, to organize it better, so it becomes better to reuse the code in other projects.

I see i can use include files and libraries, so my question:

is better to use include or libraries to organize it?

I have another question, about reusability of the code, i use functions to reuse the code, i place basically all EA work in functions, and i can only code in procedural, my question is: if i learn OOP it is better to reuse the code or there is no advantage compared to using functions?

I do not think there is any advantage in splitting the code into library files in MQL. It splits the executable as well, which is not very convenient. The include files are better for splitting code into modules.

Starting with OOP from scratch in MQL is probably not a good idea, it would be more painful than in other programming languages with their rich support in editor and basic class packages. You will find no advantage if you have no prior experience.

 
Ex Ovo Omnia:

I do not think there is any advantage in splitting the code into library files in MQL. It splits the executable as well, which is not very convenient. The include files are better for splitting code into the modules.

Starting with OOP from scratch in MQL is probably not a good idea, it would be more painful than in other programming languages with their rich support in editor and basic class packages. You will find no advantage if you have no prior experience.

Hi, thanks for answer
 
Just start typing you will switch several times to try different things and always improving.
 
Mrluck07:

Hi, i have a question, i used to place all the code in the same mq4 file, all together, but as soon the code became to big, i needed to separate it, to organize it better, so it becomes better to reuse the code in other projects.

I see i can use include files and libraries, so my question:

is better to use include or libraries to organize it?

I have another question, about reusability of the code, i use functions to reuse the code, i place basically all EA work in functions, and i can only code in procedural, my question is: if i learn OOP it is better to reuse the code or there is no advantage compared to using functions?

I've read on this forum that libraries in MQL provides less efficient code than include files. And the guy who said it, he seemed be very experienced, and he provided some measurement about that.