design patterns - Singleton class -
we have application, access the config file, have singleton class , object of used.
i understand singleton class , provide 1 instance of object. question why can't have opening , closing of config file whenever required.
ofcourse, method may expensive since windows need allot handle , dispose off when not in use.
are there specific reason using singleton class.
thank you, harsha
singleton class can pure evil. is. you'll see if ever decide apply loose-coupling code.
my advice reconsider design. think of reading config file @ application start , persisting object configuration parameters in memory. can pass object classes/interfaces require config parameters.
you may redesign application in way doesn't require numerous writes config file without using singleton (anti)pattern.
Comments
Post a Comment