Why is it a bad idea to write configuration data in code?

前端 未结 10 2166
陌清茗
陌清茗 2020-12-05 23:46

Real-life case (from caff) to exemplify the short question subject:

$CONFIG{\'owner\'} = q{Peter Palfrader};
$CONFIG{\'email\'} = q{peter@palfrader.org};
$CO         


        
10条回答
  •  没有蜡笔的小新
    2020-12-06 00:37

    It's a bad idea to put configuration data in compiled code, because it can't be easily changed by the user. For scripts, just make sure it's separated entirely from the rest and document it nicely.

提交回复
热议问题