Pete,
The original question said "global information that doesn't change a lot" -- so my proposal was based on that.
Although the sample code doesn't show it, the preceding text talked about checking the date of the local file against current date. If the date the file was created is older than the current date then delete the local file and replace it with new data from the database. This insures that this file is refreshed daily. I think that for fairly static files like Department Master or Product Categories, this is not a problem. I certainly wouldn't do this for Customer Master, Purchase Orders or any such dynamic files.
Chip,
Keeping the data in memory (global variables) is certainly a valid option specially with today's hardware where memory, unlike the old days, seems to be a non-issue (well, almost):
If you have many of these types of files in an application then we'll eventually have to give memory usage a thought.
In today's ideology of "reusability", an object (such as a form) should not rely on (i.e. make direct reference to) global variables defined in another object. Otherwise, the object would have dependencies on other objects thus making it difficult to reuse.
If we opt for passing the "memorized" data as a parameter from one object to another then we would eliminate the direct dependency issue. However, it makes programming a bit more difficult. For example:
Form A uses the Departments List (objDepts)
Form B does NOT use it
Form C uses objDepts
If A calls B and B calls C then we would have to pass objDepts to Form B even if it doesn't make use of it other than pass it along to the next form. This, IMHO, is more inelegant.
The nice thing about the text file approach, is that the front end goes about its business requesting data from the Business Object, having no idea that the data has been cached in. All it knows is that when it needs a list of departments, it calls the corresponding Business Object which returns the requested data real fast.
There is hardly ever a situation where only one answer is the correct one.
Tarek
The more I learn, the more I need to learn!