OOP issue : idea to break a vicious circle ? - page 6

JeeyCi
128
JeeyCi  
JeeyCi #:   

- 2nd - 5th principle (aka Dependency Inversion - logics like this) also can try... inheriting CMyObj from ImyFunction -- if such Decoupling really is needed (well, if this interface can be used for other classes in future or even just for independent development of it now)... 

well, I apologize  for some incorrectness -

1) interface in MQL is just an Abstract class with all pure virtual functions (it is not the C# to decouple in interface some stuff, though with private/protected/public something is possible)

2) Dependency Inversion is not about Decoupling the Action & the Object, but as Robert C. Marting talked in his "Clean Architecture" - it is about Factories & Abstract Factories - (when not Constructor is creating the object, but additional level of indirection is used - named Creator)

p.s.

but anyway, as one man told

let the Type itself to solve what method should be used - e.g. from all available overloaded functions in class methods...

-- as opposed to using RTTI...

or, I still think, CRTP, as static polymorphism, like here (for Key-Value pairs) ,  can suits the goal to inherit appropriately...

and I do not know in  modern programming situations where we have to work with naked pointers to memory (like in C), having no any info about the type & being obliged to get info about the type only in run-time ONLY... why not use static polymorphism (e.g. CRTP - Curiously recurring template pattern)?.. why ONLY wait run-time to deal with RTTI?.. I still do not believe that there can be no ways to alter THE architecture of the project to avoid RTTI...

if somebody could have evidence that this vicious circle can exist permanently in some cases (with no possibility to refactor)?? I hope such a person will answer.. especially after my link to orchardforex.com example...

p.s.

the only situation when the type can not be known in advance, I think, - when using DLLs (factories needed in dll if want to export pointer to the class in run-time), connecting/linking them to some other compiled soft

Programming a multi purpose key value pair for MQL4 - Orchard Forex
Programming a multi purpose key value pair for MQL4 - Orchard Forex
  • ajm
  • orchardforex.com
This video takes the Key Value pair class created in the earlier video on telemetry and enhances the functionality to be more generic and able to store additional data types without extensive rework.