本文介绍了定义硬编码值的最佳位置在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 如果我有许多硬编码值,例如文件路径,文件名,超时, 等,哪里是定义它们的最佳位置?意思是,例如,某些东西需要更改,而不是运行可能包含这些值的所有子函数或 函数,我想要一个地方更改它们 并将更改反映在使用那些 值的子函数或函数中。我想避免使用全局变量;保持价值仅对那些使用它们的人来说是私有的。 谢谢, Brett 解决方案 If I have many hard coded values such as file paths, file names, timeouts,etc, where is the best place to define them? Meaning, in the case somethingneeds changing for example, rather than running down all the subs orfunctions that may contain these values, I''d like one place to change themand have that changed reflected in the subs or functions that use thosevalues. I''d like to avoid globals; keeping the values private to only thosesubs or functions using them.Thanks,Brett 解决方案 这篇关于定义硬编码值的最佳位置在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-28 07:09
查看更多