Jump to content

Making hardcoded parameters flexible


clarisse

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.