作为一个编程新手,在软件目录中常常会看到这几个词,尤其 config 、 setting 翻译成中文区别不是很大,总让人有点区分不了他们的使用场景。在知乎上看到了关于这个问题的讨论觉得受益挺大的,自己总结了一下各位大佬的回答

问题链接:

config、option、setting这三者在程序世界里是什么区别?

首先是轮子哥的神回答:

Configure some options in the settings.

作者:vczh
链接:https://www.zhihu.com/question/39827177/answer/83301475
来源:知乎

另一位答主解释的也很清楚了。

从字面意义来说Config和Setting有点类似。
Config一般是配置,Setting一般是设置。
其实差不了多少。

但硬要区分的话,Config更容易联想为给开发人员使用的,用来避免一些Hard Code的可参数化的设定。
Setting更偏向于使用者或者运维人员使用的设定。比如设置一个端口号,IP地址类似的。

而Option是选项的意思。比如我们设置Socket的时候可以选同步或者异步的模式。

如何管理?
比如http://ASP.NET Core里面的Sample就不错。你可以指定多个Settings例如
appsetting.json, appsetting.Development.json
appsettings.Prodution.json。可以很好的解决版本库的管理问题。

在使用上我喜欢定义一个config类。然后将配置文件在系统启动的时候或者第一次使用它的时候加载到(反序列化)到这个类的对象。用起来就很方便啦。

作者:苏佳
链接:https://www.zhihu.com/question/39827177/answer/83301475
来源:知乎

config、option、setting辨析的更多相关文章

  1. haproxy [WARNING] 312/111530 (17395) : config : 'option forwardfor' ignored for frontend 'harbor_login' as it requires HTTP mode.

    1.经过调查, 2down voteaccepted x-forwarded-for is an HTTP header field, so has nothing to do with the tr ...

  2. ceph删除pool提示(you must first set the mon_allow_pool_delete config option to true)解决办法

    现象: 1.在mon节点打开/etc/ceph/ceph.conf,增加以下 2.重启ceph-mon systemctl restart ceph-mon.target 3.删除pool [root ...

  3. config system setting for elasticsearch

    1. disable swapping. swap 分区会导致garbage collections 花费太多时间,elasticsearch 响应变慢. 方法1:swapoff -a 方法2:vi ...

  4. GHOST CMS - 配置 Config

    Config For self-hosted Ghost users, a custom configuration file can be used to override Ghost's defa ...

  5. SAS Config文件 处理流程

    Processing Options Specified by Additional CONFIG Options You can also specify additional –CONFIG op ...

  6. Flask中的路由、实例化参数和config配置文件

    Flask中的路由 endpoint 别名不能重复,对应的视图函数,默认是视图函数名.endpoint 才是路由的核心.视图函数与路由的对应关系.可以通过url_for 反向创建url # metho ...

  7. postgresql:pgadmin函数调试工具安装过程

    通过安装第三方插件pldebugger,可实现在pgadmin客户端对函数设置断点.调试,具体过程如下: 1.下载pldebugger安装包:http://git.postgresql.org/git ...

  8. linux内核的makefile.txt讲解

    linux内核的linux-3.6.5\Documentation\kbuild\makefiles.txt Linux Kernel Makefiles This document describe ...

  9. Server Name Indication(SNI)

    转载自: http://openwares.net/misc/server_name_indication.html Server Name Indication是用来改善SSL(Secure Soc ...

随机推荐

  1. Python 的 six模块简介

    Python 的 six模块简介 six : Six is a Python 2 and 3 compatibility library Six没有托管在Github上,而是托管在了Bitbucket ...

  2. ES系列十一、ES的index、store、_source、copy_to和all的区别

    1.基本概念 1.1._source 存储的原始数据._source中的内容就是搜索api返回的内容,如: { "query":{  "term":{   &q ...

  3. spring+activemq配置文件内容及实现原理

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  4. Windows2008 r2 x64下安装FTP工具File Zilla server报错:could not load tls libraries filezilla

    安装file zilla server的时候报错: could not load tls libraries filezilla 搜索了下发现是新版本有这个问题,降低到0.9.43就没这个问题了

  5. url传参中文乱码解决

    url传参request.setCharacterEncoding("utf-8");无法解决中文乱码问题 解决方法: 修改tomcat---conf----server.xml文 ...

  6. Android设计模式-观察者模式

    原文地址 http://blog.csdn.net/qq_25806863/article/details/69218968 观察者模式是一种使用频率非常高的设计模式,最常用的地方就是订阅-发布系统. ...

  7. C <string.h>常用函数介绍

    1. strcpychar *strcpy(char *destin, char *source);功能:将source指向的字符串拷到destin. int main() { ]; "; ...

  8. Scala集合笔记

    Scala的集合框架类比Java提供了更多的一些方便的api,使得使用scala编程时代码变得非常精简,尤其是在Spark中,很多功能都是由scala的这些api构成的,所以,了解这些方法的使用,将更 ...

  9. 深度学习Bible学习笔记:第二、三章 线性代数 概率与信息论

    推荐资源: <线性代数的本质>:Essence of linear algebra 视频教程 <数学之美>(科普类书籍),吴军系列书籍都不错. 易向军<大嘴巴漫谈数据挖掘 ...

  10. nginx部署网站

    部署单个网站非常简单,只要将网站HTML文件和资源文件(.jpg .css .js等)全部复制到nginx-1.13.12\html目录下. 然后启动 启动进入cmd,切换到nginx-1.13.12 ...