4 ms·
For all of its warts, YAML hits the sweet spot between readability, writability, commentability, and (mostly) intuitive syntax. It's easy to serialize complex o
by woodruffw 5y ago
For all of its warts, YAML hits the sweet spot between readability, writability, commentability, and (mostly) intuitive syntax. It's easy to serialize complex objects to, and comes bundled with Ruby's runtime.
There are a lot of valid complaints about YAML, but I still reach for it when I really only need a barebones configuration file.
- smt88 5y ago> For all of its warts, YAML hits the sweet spot between readability, writability, commentability, and (mostly) intuitive syntax. Could not disagree more strongly and it seems many others in software agree, based on this comment section and the original article. > It's easy to serialize complex objects to, and comes bundled with Ruby's runtime. I don't know that Ruby support is why it's widely adopted. Ruby is common in some spaces, but not a wildly popular language at all. I honestly think some popular project (maybe Docker Compose or something from HashiCorp?) used it for a config file and then everyone else started doing it too.
- atoko 5y agoI would bet on the source probably being gitlab-ci configurations
- woodruffw 5y agoTravis CI predates Gitlab CI by several years, and uses YAML. Definitely a big source of peoples’ YAML experiences these days, but not one of the original ones.
- woodruffw 5y ago> Could not disagree more strongly and it seems many others in software agree, based on this comment section and the original article. They sure do! But lots of people also agree, as evidenced by people continuing to use it. The world keeps turning, and we engineers keep using suboptimal things. > I don't know that Ruby support is why it's widely adopted. Ruby is common in some spaces, but not a wildly popular language at all. Ruby’s now gone out of fashion, but it was the most popular web development language (especially among startups) for the better part of a decade. It’s conjecture, but I wouldn’t be remotely surprised if Ruby brought YAML into a lot of shops by virtue of bundling it. Docker (and Docker Compose) came into full force a few years into Ruby’s peak, so it’s the egg to Ruby’s chicken. And we’ve all forgotten that Hashicorp was originally a Ruby shop!
- emodendroket 5y ago> I honestly think some popular project (maybe Docker Compose or something from HashiCorp?) used it for a config file and then everyone else started doing it too. Kubernetes maybe? It also supports JSON but JSON is less friendly to manual editing and source control IMO. Anyway, sure, a lot of people in software disagree. For almost any opinion you might have, you could find many to agree, and many to disagree.
- geerlingguy 5y agoIf you've ever tried managing complex, human-centric configuration in JSON, XML, ini, or most any other format, you realize it ticks a lot of the checkboxes that are necessary for a good human-readable configuration format: Requires some amount of legibility out of the box due to whitespace requirements. Can store complex data structures (and even direct JSON). Allows comments.
- emodendroket 5y agoHand-writing escaped JSON is an exercise in frustration, unlike YAML. Another point in its favor.
- lamontcg 5y ago> Requires some amount of legibility out of the box due to whitespace requirements. which makes it terrible due to semantic whitespace rules. parsers shouldn't care about legible whitespace linters should care about legible whitespace
- api 5y ago> comes bundled with Ruby's runtime. It comes bundled with something. Question answered. TOML may get more popular due to Rust.
- woodruffw 5y agoI like TOML a lot, but it still misses a few of the checkboxes: it’s not actually bundled with Rust, and the table syntax is pretty unintuitive (IMO) compared to YAML’s array-of-dictionary syntax.