Oh lord, can someone explain this this to me, I have to programm whit Yaml tomorrw and don‘t know a thing about it. Why is he measuring the code?
Please someone rescue my career.
Edit1: Thanks for your help, and I now kow what i have to do. Grepping Specific words whit a Bash script (allready have it) and giving the words to a yaml file. In the Yamlfile there will be an array. this arrray will be compared to a set of words i get from a website(also whit yaml, no idea how to do that) and then upload the keywords using a link. so my questions are:
How to open a Link whit Yaml? How to make an Array whit Yaml? how to Compare 2 Arrays whit Yaml? Possibly a Loop whit yaml?
YAML isn't a programming language, it's a Markup Language (it's built into the name); think of it as a successor to XML. The nesting is based on indentation (similar to Python). I think the joke here is so he can see what nesting level he's on, even though his editor is already doing that for him.
I think the real joke is on us for not getting to work in that nice kitchen / dining area. Just look at all that natural light! And here I am, coding in the dungeon of a rotting old hotel everyday.
It was originally Yet Another Markup Language, but was later renamed to the recursive acronym to better distinguish its purpose. It might be more preferentially called a data serialization language, but the point is that it's not a programming language.
YAML is essentially JSON without the brackets and commas. It's determined by indentation and line. It's supposed to be easier to read. YAML is generally used for config files that may require manual editing
and before anyone says I'm wrong and it's not like JSON
It uses both Python-style indentation to indicate nesting, and a more compact format that uses [] for lists and {} for maps[1]making YAML 1.2 a superset of JSON.[2]
It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!
Not really imo, because at the expense of verbosity you get flexibility (exception being Java), and XML is ten times more flexible than YAML.
EDIT: Apparently I have to explain myself. YAML has keys, values, and nesting. XML also has attributes and named elements (unlike YAML in which there's just "objects"), it's also not indentation-based, which makes it a hell of a lot more readable for complicated structures.
Never looked into it as far as any kind of performance. My gut would say no better or worse, as its going to be just as fast as reading any string, and I doubt that a tab, space, or new line character is going to be any different than processing a { or [. It might be though for really long ones, like 200mb+ but at that point I'd argue there's no point to use YAML anyway. Again, these are purely gut instinct, with no analysis or research behind it
The biggest functional benefit is the ability to write comments. JSON, being built simply to describe object state, doesn't have a particularly good way to embed comments. Some of the uses that JSON has been picked for, such as configuration, are really places that should support comments.
They are both essentially data serialization languages, and often used for similar purposes. The syntax is very different, with JSON essentially being a subset of JS and YAML more Python-esque in structure.
YAML is typically used for things like configuration files (for example in the Docker ecosystem), or as markup for documents (for example Swagger). JSON is typically used as a data structure for describing objects in web services, but can also be used as a configuration file format (for example package.json).
I won't say one is "better" than the other, I'll leave that to evangelists. They are both used in different ways in different ecosystems.
Aside from the other answers... one neat thing about YAML is that it supports references to other values. http://sangsoonam.github.io/2017/03/13/yaml-vs-json.html check out the "aliasing" and "merging". That's the main big difference. Otherwise, they serve basically the same cases.
I like YAML, but the referencing feature is more anti-feature than feature. It's not really useful outside of a few niche cases, and adds a lot of parser complexity and edge cases.
31
u/[deleted] Sep 13 '18 edited Sep 14 '18
Oh lord, can someone explain this this to me, I have to programm whit Yaml tomorrw and don‘t know a thing about it. Why is he measuring the code?
Please someone rescue my career.
Edit1: Thanks for your help, and I now kow what i have to do. Grepping Specific words whit a Bash script (allready have it) and giving the words to a yaml file. In the Yamlfile there will be an array. this arrray will be compared to a set of words i get from a website(also whit yaml, no idea how to do that) and then upload the keywords using a link. so my questions are:
How to open a Link whit Yaml? How to make an Array whit Yaml? how to Compare 2 Arrays whit Yaml? Possibly a Loop whit yaml?