I have a method that takes in a dictionary and enum value and produces a string output. Enum value defines what template string to insert the dictionary key value pairs into.
public string InsertVariables(MessageType type, Dictionary<string, string> variables) { }
It works fine, but every time I use it, I find that it's hard to know what I should add to variables to make sure all tokens in the template are replaced and I have to glance at the templates every time.
What I was thinking would work as solution in this case is enforcing proper values added to variables during compilation time like so:
public abstract class MessageVariables { }
public class NewUserMessageVariables : MessageVariables {
// different values go here parameters go here instantiated in the constructor
}
public string InsertVariables(MessageType type, MessageVariables variables) {
// converts variables object into dictionary for future insertion into the template.
}
This seems to enforce having all parameters required in the messages.
I have about 16 messages with possibility to having a few more later.
QUESTION: Is this an overkill and I should stick to using dictionary?