3 ms·
My experience is that with both YAML and XML, the key is to have a well-designed schema. The problem isn't YAML or XML, but abuses of them. Most of the criticis
by blagie 4y ago
My experience is that with both YAML and XML, the key is to have a well-designed schema. The problem isn't YAML or XML, but abuses of them. Most of the criticisms come from badly-designed schemas. HTML 2.0 was very usable, and there are other XML schemas which are nice.
There are a few keys:
1. Don't reinvent constructs. If your XML looks like <element name="foo"><attribute key="bar" value="biff" /> </element>, you've got a problem. It should be <foo bar="biff"/>
2. Provide reasonable defaults. Everything should be optional.
3. Break up files into manageable chunks
I wish everything in /etc/ used a common format, like YAML, or a small set of common formats.
I also wish for good configuration libraries, which handled:
- Parsing / validating YAML config files, command line parameters, environment variables, database overrides, defaults, etc.
- Printing pretty error messages
- Worked in a few languages (Python, JavaScript, and perhaps C)
- Guided developers towards sane designs.
Also, if you're putting objects in XML, documents in YAML, or strictly tabular data in either, you're probably doing something wrong.
- YAML: Configuration files, objects
- XML: Documents
- CSV/TSV/TSVX: Tabular data
- orev 4y ago> I wish everything in /etc/ used a common format, like YAML, or a small set of common formats. This is what makes the Windows registry such a success. I think too many Linux people hated Windows for too long that they ignored this problem. Microsoft already had the solution in Windows 95. Early iterations maybe weren’t perfect, but they stuck with a standard API and everyone got onboard. It completely removes an entire set of problems that Linux people keep reinventing the wheel for.
- blagie 4y agoThe registry is far worse than Unix. A problem with the registry is discoverability and documentation. It's a bottomless black hole. I am glad it's standardized. I'm not glad it's binary, huge, and opaque.