Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The use of config file is it equivalent to use of globals?

I've read many times and agree with avoiding the use of globals to keep code orthogonal. Does the use of the config file to keep read only information that your program uses similar to using Globals?

like image 413
osp70 Avatar asked Nov 10 '08 18:11

osp70


People also ask

What is a config file used for?

A configuration file, often shortened to config file, defines the parameters, options, settings and preferences applied to operating systems (OSes), infrastructure devices and applications in an IT context. Software and hardware devices can be profoundly complex, supporting myriad options and parameters.

In what directory are global configuration files stored?

Most global config files are located in the /etc directory. The /etc/ directory feels more like a filesystem and has many sub-directories, each having related config files. The following is a list of the most useful of these sub-directories: /etc/X11/ – xorg specific config files.


1 Answers

If you're using config files in place of globals, then yes, they are similar.

Config files should only be used in cases where the end-user (presumably a computer-savvy user, like a developer) needs to declare settings for an application or piece of code, while keeping their hands out of the code itself.

like image 95
David Koelle Avatar answered Oct 19 '22 14:10

David Koelle