I've been wondering this for a long while now: When you develop a program for someone else should you make it dynamically configurable?

For instance, if the program I was asked to develop must interact with an API for a game with a specific ID, should I introduce an interface to switch the game ID or should it be statically specified in a configuration file? In case the developers of the game decide for whatever reason to start a new project for the same game, that game is going to have a different ID and my program won't be compatible.

If not explicitly specified, what do you think is the right approach?

  • 3
    I usually start with hardcoded values. But make sure that those are easy to upgrade to variables and configurables later, i.e. do not copy the value, reference a single constant.
    – Basilevs
    Commented May 19 at 9:48
  • 4
    Depends on who will have to change the configuration and how often. If it is the developer who have to change it, just hardcode it (with the appropriate documentation). If an end-user have to change it, it need some UI. A configuration file is appropriate if the configuration change more often than the code, but will be changed by a developer or administrator, but not an end-user.
    – JacquesB
    Commented May 19 at 10:54

2 Answers 2


Talk to your customer. The specifications should include details of what level of user accessible configuration is expected. If it does not, ask for clarifications.

The best place for configurations depend on the likelihood that they need to be changed, and the possible effects of not being able to change it. A configuration file is a kind of middle ground, allowing advanced users to make changes, while still being fairly easy to manage by the developer, and hiding settings from accidental change by novice users.

In this specific case, changing of IDs may be a "breaking change", to it will likely not be done without good reason. And if it changed for good reasons there might be other API changes that require other modifications of your program. I would recommend reviewing the API documentation for when and how IDs may change.


A configuration file in an easily readable and editable format provides the most efficient method of keeping your IDs synchronized. It doesn't require a developer to make the change, and there's no build process or deployment necessary. The change is made in situ while the application isn't running or before restarting it.

  • 1
    But imagine you have a one-line program (shell script, for example). Adding a configuration parser to it can double the length. There is definitely a scope, where configurationfile makes no sense.
    – Basilevs
    Commented May 19 at 16:55
  • 2
    @Basilevs A one-line script fits my definition of "a configuration file in an easily readable and editable format." It's its own solution.
    – digimunk
    Commented May 19 at 17:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.