Any assistance or links to similar inquiries would be greatly welcomed as I have conducted some research but am uncertain about the best approach to take in this situation.
I find it difficult to articulate exactly what I need, so I have created a visual aid to provide some clarity:
https://i.sstatic.net/JiuPe.png
Currently, all my code is contained in one file and I wish to refactor it to make it more modular so that others can develop their own 'strategies' using system objects and such.
The primary objective here is to centralize all system code changes, as I have multiple strategies and updating the system code requires edits across various files.
A relevant comparison I can draw is with the npm module testcafe. Once downloaded, its usage in your code is similar:
import testcafe
test(testName, => { all the desired code goes here, with access to numerous
provided objects and functions from testcafe })
My initial thought is that perhaps utilizing global classes may be necessary, such as a class named "strategy" containing all the required objects, functions, loops, log results, etc.
Some concerns on my mind include:
- how user-defined globals can be integrated into the strategy
- ensuring that users do not encounter errors for their defined globals, functions, and objects existing outside of the system code while typing in their IDE
This concept is quite high-level, and I'm not seeking precise lines of code to tackle it all (though that would be appreciated) - rather, I am looking for guidance, suggestions, and avenues for further exploration. Any help is highly valued!