This time, I’m gonna create a math problems. I plan to have a dictionary where the key is Levels enum {Easy, Medium, Hard} and value should contain some configuration about how to create the problems.
For example:
BinaryProblemConfiguration
+ Bound1 : Bound<int>
+ Bound2 : Bound<int>
Bound has two properties: min and max.
Others types of problems don’t need Bounds, but need other data.
So, I was thinking create a interface called IConfiguration.
public interface IConfiguration {}
And concrete Configurations should be:
public class BinaryProblemConfiguration : IConfiguration
{
public Bound Bound1 {get;set;}
public Bound Bound2 {get;set;}
}
public class AnotherProblemConfiguration : IConfiguration
{
// other stuff
}
The idea is to have a dictionary called ConfigurationLevels. Is this a good practice left the interface empty or means is wrong with my design?
The .NET Framework Design Guidelines calls this a “marker” interface and definitely says that it is a bad idea. They recommned using a custom Attribute instead.
http://msdn.microsoft.com/en-us/library/ms229022.aspx