• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

config files

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey all,

Developing applications, I've noticed I have a config file for each application to parse to determine enviromental settings (i.e. database username/passwd, location of helper apps, etc.). Each time there's a software upgrade, database upgrade, etc., I have go into each one of these config files and change some of the parameters. I was thinking I could create a soft link that pointed to one config file that contained all possible environment type variables. Then I could have this file parsed with a Configuration class, that implemented a Singleton design pattern, which would read the variables into a hashTable. This seems like it would significantly reduce the amount of maitenance I had to do on the apps, while not unbearably wasting resources, since only one instance of the Configuration class (and thus an enormous hash) would be loaded into the JVM.

I was wondering what other people have chosen to do approaching this type of problem.

Thanks,
Jason
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jason

The java.util.Properties class is for just that; loading and storing a persistent set of properties. It also inherits from a HashTable.

Ramen
[ May 16, 2006: Message edited by: Ramen Chatterjee ]
 
Marshal
Posts: 27450
88
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is your goal to improve some aspect of your application's code, or is it to simplify the process of maintaining the config files?
 
Jason Fagerness
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help. I also noticed an older posting that pointed to an article I found relevant. I'm finding out that Java has many built in features that automate and aid in maintaining the software. My dilema is two fold: develop high quality software in the future that is easier to maintain, and fix some of the maintainance issues I face with the applications already developed. Unfortunately, I have 50+ applications (not counting web tools) I'm involved with maintaining that are writting in diverse languages (C, C++, Perl, Java, Korn shell scrips, PHP, etc.) They are all small to medium sized programs, and they all have some type of environment information they need to function correctly. The majority of them source env. files and read config files to obtain the information. I've always felt each programming language and pros and cons, and you choose the best language for the particular task you faced with. One of the O'Reilly books on Perl I read, the author makes a statement that some people have a hard time ,switching back and for between languages, remember some of the differences in syntax. He recommended to stop switching, and just use Perl for everything. The more I learn about Java, the more I feel like I should stop switching between languages and just use Java for everything. I guess I don't have a lot of choice though, seeing as how much of my work is maintaining software other people wrote.

Thanks,
Jason
 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic