12 ms·
> therefore, you will be externalizing these values and decouple them from the application, which will give you great flexibility in the long term I think this
by d_burfoot 7y ago
> therefore, you will be externalizing these values and decouple them from the application, which will give you great flexibility in the long term
I think this is one of the worst "Best Practices" ideas that are parroted by people who haven't thought deeply about the issue. It's really a bad legacy from the era when most software was actually distributed. Now that most software runs in environments that are controlled by the same organization that developed the software, the principle is far less valuable.
Nowadays, most software should have most of its configuration information - paths, DB URLs, HTTP endpoints, etc - hard-coded into it. This strategy follows the "convention over configuration" philosophy, and it gives you a range of benefits. First of all, you can run tests on your config to make sure everything is working properly (check various files are present, do a SELECT * LIMIT 1 from DB tables, etc). You can catch config errors at compile time, eg by using enums like prod/dev/qa to represent environment names. And it prompts you to apply a refactoring mindset to your config - when you notice that your config code is repeating itself extensively, you'll realize this and be able to take steps to refactor, standardize, and simplify the config.
- lbotos 7y agoThis feels... backwards, but it's probably because I'm indoctrinated to external configs. Do you have references to companies that are developing software this way at scale?
- Izkata 7y agoI'm not entirely sure if this is what GP was describing, but as a quick example, likely any that use the Django web framework. By default it puts the settings inside the repo, and at least at my work we just build off of that by putting multiple settings files in the repo and switch between them depending on dev/beta/live/etc.