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?


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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.