Use a compositional model instead of inheritance for Robot

Created at 18 May 2016, 07:24
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
NI

nicolai

Joined 04.02.2016

Use a compositional model instead of inheritance for Robot
18 May 2016, 07:24


At the moment we have to inherit from the robot class to allow us to write robots, this is a problem as it makes it much harder to unit test our robots. Could we not have an interface instead ? and expose the robot class more as a service ? So that we can inject it into our robots instead ? that would enable us to mock the cAlgo api, use ioc etc, you could even start splitting up the api, so we would only depend on what we needed ?


cTrader Automate
@nicolai
Replies

WhiteSage
25 May 2016, 07:29

I wish I had votes left! This is exactly what you might expect from a platform that does not need to rely on interpreted scripting.


@WhiteSage

... Deleted by UFO ...

... Deleted by UFO ...

jaredthirsk
24 Jun 2016, 11:28

If you truly want this to be a professional platform with high quality user code to bolster the ecosystem, ease of unit testing seems like a good thing.


@jaredthirsk