Pergunta

I'm a contributor to a framework that's designed for producing synthetic data. The system allows the end-user to create custom data generators and load them into the framework. Currently we store the available generators in a dictionary. We then look-up the generator by name, and return the value generated by that to the user.

There are also a few generators that come 'out-of-the-box' with the framework. I've run into a problem, however: how can I prevent the end-user from overloading a method in the framework? Given that we are using a dictionary, overloading would be done simply by calling the generator the same thing. What are some options that I could explore here to prevent this name collision?

Foi útil?

Solução

I would put an interface in front of the dictionary and disallow the addition of generators named the same thing as one of the framework generators.

Licenciado em: CC-BY-SA com atribuição
scroll top