About the MQL4 learning curve - page 2

 
forexgenuine:About " It takes less time to decide where to put print statements than to single-step to the critical section of code, even assuming we know where that is." maybe for them but for not a genius like me even thinking hard about how to do thing first doesn't prevent me to make error and have difficulty to find it witout seeing the actual value within the context at runtime. Often it is because you didn't think about some contexts happening that you have bugs.



Inserting print statements does not take much thinking at all, if not sure add a print statement to every branch of the code in question, then remove them one by one as you home in on the 'bug'. I do this often... It is much easier than deciding were to put break points in a debugger, and much faster than single stepping every line. Trust me :)


It looks crude, but when I'm at a loss where to put a print statement I often (temporarily) have...


Print(111,...);

....

Print(222,...);

....

if (blah) {

  PRint(333,....);

 ...

} else {

  print(444,....);

 ...

}


Run it, then tidy up afterwards....

 
ydrol:


Run it, then tidy up afterwards....

No need to tidy up, just turn them off . . .

My way . . . https://www.mql5.com/en/forum/135598

 
RaptorUK:

No need to tidy up, just turn them off . . .

My way . . . https://www.mql5.com/en/forum/135598


Yup I have conditional logging too, just when extremely puzzled I put in a lot of extra temp logging which IMO clutters the readability of the code, so once I've fixed the bug, I remove it and just leave the more useful generic logging behind.



 
ydrol:

Yup I have conditional logging too, just when extremely puzzled I put in a lot of extra temp logging which clutters the readability of the code, so I remove it and just leave the more useful generic logging behind once I've fixed the bug.
I just change it to D5, never know when it might be needed again . . .
 
RaptorUK:
I can live very happily without OOP

Me too. I think Richard Mansfield put it best when he said "OOP is to writing a program, what going through airport security is to flying"

Reason: