I’m having troubles trying to design classes.
I have abstract Chip class, STM8 class which extends Chip and implements IConfigurable (which has Configure method).
I expect each class, which implements IConfigurable to have a method Configure, which takes one arguments to decide what to configure, using strategy pattern (methods).
Psuedo code:
public void Configure(Periphial p)
{
this.periphials[p]();
}
Of course things to configure differ on each class. For example, STM8 can have GPIO and Timers, and STM8L can only have GPIO. Then, the way each subclass is created should be stupid-proof so I would like to force people to declare their own enum inside their classes.
At last, would it be a good idea to initialize a dictionary with a pair of enum/delegate for showing what is possible to configure? this.periphials used in pseudo-code above?
And what if your Periphial (should it be named Peripheral instead?) did have a Configure method?
or if your Peripheral returned a configurator?