Thanks for your answers, everybody. It seems like few of you agree with my particular design choice, which is fine, and I'd love to hear how you would go about this problem. But first let me explain why I'm doing what I'm doing.
Suppose I have a class, Exporter, dedicated to exporting a file. It is a class, not a module, because I might want to have several exporters each with their own settings, etc. So now I have
dim myExporter as new Exporter()
My exporter needs to have some data given to it, and a filename to save into. So I now have several options:
1) keep the empty exporter constructor and add
myExporter.performExport(data, filename)
I don't particularly like this, if the exporter is complicated (and my premise is that it is -- otherwise a module would have done fine), then I want it to maintain its own state, which just might be related to the data and filename. It makes more sense to redo the constructor, as in option #2:
2) pass the parameters in the constructor:
dim myExporter as new Exporter(data, filename)
and then call with a simple no-argument call:
myExporter.performExport()
This is fine, but notice how essentially, even though I'm declaring myExporter, I am only using it as a one-shot call: create and perform export. Essentially I don't need a reference to it, as @brian-m suggested, I could just do
Call new Exporter(data, filename).performExport()
(@code-gray, note how I now am using an object without a reference, yet it's not non-sensical).
But now I just have to type extra code every time -- the performExport() part. If I know I will always want to act upon the object as soon as it's created (@brian-m, I agree that there are some cases when I might want to prepare my object and then DELAY execution, but at other times the execution may as well happen immediately after object creation) I may as well put the acting code in the constructor too, so I don't worry about forgetting to make the call. So now I have
dim myExporter as new Exporter(data, filename)
which needs no further call, because it exports immediately upon being created. From the rest of the program's perspective, I don't care what happens to the exporter once it's done -- I did not mean to get hung up on garbage collection, I just wanted to say that I have no need in maintaining a reference to the exporter.
So far so good? If so, then I hope you'll agree with me that it would make even more sense to get rid of the "dim myExporter as" part, and just leave "new Exporter(data, filename)". Except VB.NET, unlike Java, does not seem to allow that.
Thanks for reading, I'm looking forward to hearing your suggestions.
-- Michael