What type of application / use is YAML that is best suited?

Why choose YAML over XML or any other formats?

+7
xml markup yaml
source share
5 answers

I agree with Sergio; YAML provides a format that people can easily edit, but it is also a good way to present data structures cleanly.

YAML tends to be much more human readable, IMO.

YAML is more a data serialization method than a markup language.

+9
source share

YAML Main advantages are human readability and compactness. Oh, and it is widely supported across platforms and languages.

YAML is very popular in the Ruby community, where it is mainly used in preference XML for configuration files in Rails and Merb, for example.

+7
source share

I would choose YAML if the documents needed to be edited or created by people. Just a thought.

+4
source share

What type of application / use is YAML most suitable for?

It is difficult to answer unequivocally. Instead, I will try to give a few examples of the fact that YAML is not suitable (in my humble opinion).

<name type="string">Orion</name> <age type="integer">26</age> 

This is an example of where it is useful to mix both attributes and values ​​in XML. YAML has no attributes, so you need to use type inference to determine what date / integer / string / etc is - this is not possible for complex or user-defined types.

 <user> .... 10 lines of stuff <sub-user> ...15 more lines of stuff </sub-user> .... 10 more lines of stuff belonging to user </user> 

This is the case when closing tags in XML provide a big benefit. If you formatted the above data in YAML using only indentation to provide a β€œregion”, it would be much harder to say where to start and end things.

For good measure, here is a quote from the official yaml specification on yaml.org

YAML is, above all, a data serialization language. XML was designed for backward compatibility with the standard generalized markup language (SGML) and, thus, it had many design restrictions that YAML did not share. Inheriting the legacy of SGML, XML is designed to support structured documentation, where YAML is more closely oriented to data structures and messaging. Where XML is a pioneer in many domains, YAML is the result of lessons learned from XML and other technologies.

+1
source share

I use YAML as a cheap and easy substitute for writing a domain-specific language (especially when other developers will perform maintenance, I'm not sure I will use it when non-developers support it)

0
source share

All Articles