Creating different instances in a loop
<p>I'll be writing a validator for a specific file format (the format itself is unimportant). There's a large set of documents that specify what every section of the format needs to look like, how the different parts relate and so on. Lots and lots of MUST's, SHALL's, SHOULD's, MAY's etc.</p>

<p>The architecture I envision is as follows: load the document into memory/separate files on disk, and then run numerous validation "passes" on the document: every pass would check for the adherence to <em>one and only one</em> rule specified in the standard, and if the pass fails, an error message is printed to stdout. Every pass would be a separate class implementing a common interface and an instance of each pass would be created on the stack, run on the document and the Result collected (containing error ID, message, line/column number etc). The Results would then be looped over and messages printed out. A unit test could then be easily created for every pass.</p>

<p>Now, I expect to eventually have <em>hundreds</em> of these "pass" classes. And every one of these would need to be instantiated <em>once</em>, run over the document, and the Result collected. </p>

<p>Do you see where I'm going with this? How do I create all these different instances without having a 500 line function that creates each and every one, line by line? I'd like some sort of loop. I'd also like the new pass classes to somehow be "discovered" when created, so I don't have to manually add lines that instantiate those new classes.</p>

<p>Thinking about it now, all this seems to remind me of unit testing frameworks...</p>
