clarisse Posted April 7, 2008 Posted April 7, 2008 I was wondering whether anybody here has experience in trying to make hardcoded parameters flexible. I'll explain a little bit of the situation to be more specific: Say I have a program that I have to run in handheld devices. When I have this program compiled, it propagates from the server to the devices. However I need to be able to update some parameters that are currently hardcoded into the code from the server as opposed to having to go to the code, change the values, recompile and have to propagate them again to the devices. Any suggestions? As you can tell, I am a complete novice so I would really appreciate some help and suggestions
Cap'n Refsmmat Posted April 7, 2008 Posted April 7, 2008 Ideally you'd have a central configuration file that the code would access, read, and then use to set the parameters.
mooeypoo Posted April 8, 2008 Posted April 8, 2008 You don't need them "hardcoded" then... the entire point of "hardcoded" is that you *can't* change them. What you can do, though, is create a file with your configuration variables. Same as mirc has mirc.ini or wordpress has configuration.php .. in this file you define whatever you want as your variables. And then, your program reads this file. Using XML or .ini is most comfortable, because they have "comfortable" structure to read. One of the variables should be version number. That way, if you add a 'script' to your program to check a remote server for version number and compare with teh version you have - if the server has newer version, just create a script to "download" a new config file, or to update the config file (by writing into it).. That's one of the ways I can see, but perhaps there are more... Hope that helped ~moo
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now