I have a script with a bunch of Subs & Functions that make use of the FileSystemObject, and currently I have a local objFileSystem variable in each procedure. My initial thought was to make the procedures decoupled and reusable, but now I am wondering if I am better off with a single global scope objFileSystem?
I understand this wouldn't be a true Singleton (being VBScript), it is just the question of a single shared object vs multiple dedicated objects, which is like a Singleton.
I have recursion in a couple of places, and I am curious if that changes the best practice at all?
I have a similar condition with a Registry object, and I wonder if the best practice is the same, or do these two behave differently?
I am not (overly) concerned with performance nor memory management, but I would like to understand the Why of any best practice.