I've been tasked with overhauling a fairly large web-system that requires much user input. In an attempt to instruct the users when making input, the original creators has made extensive use of feedback structures like help texts and tool-tips.

The problem for me is that all the text material used for user feedback is written directly in the source code; either as variables and constants, in plain HTML tags or even in the SQL-model. Since my knowledge of this system is limited to only a few months of experience it is difficult for me to get an overview of all the utilized material, let alone find it's source. Now I am thinking of doing something about it.

What is good practice when dealing with data integrated in source code? In my case I would prefer to have all text data loaded from a structured external source.

In terms of refactoring this is perhaps best practice, especially if someone who is not a programmer is tasked with modifying the data later on. However, separating content from it's place of use adds to the complexity and decoupling of the program.

  • The answer highly depends on which programming language is used. can you add it?
    – k3b
    Jul 5, 2016 at 16:09
  • @k3b it's mainly a Python and SQL backend, front-end is made up of .js and HTML. Jul 6, 2016 at 6:18

2 Answers 2


Interspersing large amounts of data with program logic is so bad that added complexity in your code base is a cheap price to pay for it. Make the transformation, and you'll probably be rewarded with additional of opportunities for refactoring to simplicity.


You have to ask what you hope to achieve by this - if its only to get a list of string resources for your own benefit, you might as well just try to learn the system. You say that a lot of it is in the form of constants and variables so all you would gain from putting the data into an external file is to replace the original with more constants or variables (as the data will not find its way into the code otherwise)

It sounds like what you really want is consistency of how the data is used. If there was a single function that mapped every data string that was used from source to code, then it'd be trivial to see where everything was. The data can even remain in place, tools like translate toolkit use this approach were the default is embedded into code and any translation can override them if present.

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.