mercredi 5 juin 2019

How should I design this feature?

Ok, so I wrote a telegram bot which receives a request [a request is defined as a command (based on command pattern)] and invokes it by looking up the command from the command factory (which holds the list of commands).

Now, I have two commands (features) that I want redesigned. Those two commands are temperature monitoring systems. There's a fixed temperature monitor (which is started and stopped manually) and a scheduled temperature monitoring (which is started with two arguments, duration and timer interval and is stopped when the DateTime.Now meets the duration [or could be stopped manually too]).

Now, something to take into mind is that I have multiple commands that need to access the same instance of the temperature monitor system (don't forget there's two types of them).

My current design (which I don't like) is to use an interface which holds all commands (violating interface segregation principle), some other properties and events. And then inherit from a base class which shares some common functionality between the two types of temperature monitoring systems.

But I don't like this approach, I want something flexible, I want to apply a pattern which will make this design more efficient.

Aucun commentaire:

Enregistrer un commentaire