3 ms·
If configuration starts becoming more complex than looking up key value pairs, why not just write it in the programming language you are using? More languages /
by hestefisk 7y ago
If configuration starts becoming more complex than looking up key value pairs, why not just write it in the programming language you are using? More languages / serialisation just adds another layer of complexity. Config as code is actually really neat.
- _def 7y ago- can only be done in script languages(?) - syntax errors I get what you're saying and it can be neat, but I don't think it's universally applicable
- zeckalpha 7y agoWhat if you're using multiple programming languages?
- hestefisk 7y agoThen cue might be a good idea.
- prepend 7y agoThen just pick one of them. This may be simpler than introducing another language to the project.
- zeckalpha 7y agoWhat if you are interfacing between multiple projects? It’s not about introducing another language, it’s about integrating pre-existing systems.
- pmontra 7y agoSome web projects validate inputs in JavaScript, then in a possibly different backend language, then (unusually) in the database with CHECK statements. Even when it's all JavaScript the validations are different because the frontend and backend frameworks are different. And some projects have multiple backend services written in multiple languages.
- locusofself 7y agohow does this apply to compiled languages though?
- hestefisk 7y agoRecompile when config changes.
- cwp 7y agoIf you're going to do that, you don't need configuration at all. Just hardcode everything.
- johnisgood 7y agoYeah, and it is not really new either. ioquake3 did that, it had a header file for some values. If you changed them, you had to recompile the QVMs. So then we added cvars, and some values such as HP, DMG, etc. stayed in the header file. I learnt programming C by fiddling around with ioquake3 and its forks, Tremulous especially. Good times.
- otabdeveloper2 7y ago> If configuration starts becoming more complex than looking up key value pairs, why not just write it in the programming language you are using? Because you want to write a config file, not a program? What next, config files, build systems and unit tests for your config files? No thanks.
- Existenceblinks 7y agoBut this is a language, so it needs to be a program to run? Oh wait.. feel like I miss the joke.