title: Best approach storing and accessing Java application data
body: <p>I'm in the middle of a massive refactoring project, the code has a 5000 line main class which was injected into everything, stored everything and had all of the common code. </p>
  
  <p>I'm no expert on analysis and design but I've separated out things to the best of my ability and I'm about 80% through refactoring the classes that depend on the main class to use the new classes I've created. </p>
  
  <p>There are some types of data which are initialised when the application starts and accessed by pretty much everything throughout the life of the application. For instance there is a Config class which holds hundreds of parameters. </p>
  
  <p>The approach I've taken is to create several singletons the two most central are GUIData and ClientData. GUIData contains a reference to the mainframe of the application and clientdata maintains references to the config and other similar classes. </p>
  
  <p>This allows me to call ClientData.getInstance().getConfig().getParam("param") from anywhere in the code but I don't feel like this is the best approach. </p>
  
  <p>I considered individual static classes instead of these data singletons which contain instances of the classes but some of the classes do need constructors.</p>
  
  <p>I've been googling on and off for a week trying to find a better way to do this but somehow I always end up on threads talking about database caching</p>