I'm creating an object whose sole purpose is to read in a file of one format and create another of a different format.Is it best to create the output file implicitly during object initialization or to have a public method that gives the user the choice when this file will be created?
Should the creation of an object implicitly or explicitly create a file?
object oriented;file handling
If you are working in a language that supports it, I'd provide a Save method that takes a Stream. That way, the user can save the data whereever he or she wants.It takes 20 seconds longer to write than saving just to a file, but it is easily understood by a programmer, and at the calling site it is very clear what actually happens.The way you described it (an object that reads input, and outputs to another file) otherwise  seems weird. What is the purpose of constructing an object that does everything during construction?Would you call it this way?var stuff = DoStuff();new SaveFileWeirdClass(stuff);return;For any reasonable implementation of SaveFileWeirdClass I would expect no side effects from just creating it. Reading a file - fine. Creating a file? No.To me it seems clearer this way:var stuff = new StuffReader(); //Better name needed...string filePath = this.whatever;using(Stream stream = new FileStream(filePath))    stuff.Save(stream);