YAML (YAML ain't markup language)

YAML (YAML ain't markup language)

What is YAML ?

YAML is a data serialization language that is often used for writing configuration files. Depending on whom you ask, YAML stands for yet another markup language or YAML ain’t markup language (a recursive acronym), which emphasizes that YAML is for data, not documents.

Why YAML ain't Markup Language ?

YAML is a data-oriented language structure used as the input format for diverse software applications. YAML is not intended to be a markup language used for document markup.

What is data serialization ?

Data serialization is the process of converting structured data to a format that allows sharing or storage of the data in a form that allows recovery of its original structure. In some cases, the secondary intention of data serialization is to minimize the data’s size which then reduces disk space or bandwidth requirements.

serializatiuion.jpg

Why do we need data serialization ?

In some distributed systems, data and its replicas are stored in different partitions on multiple cluster members. If data is not present on the local member, the system will retrieve that data from another member. This requires serialization for use cases such as:

Adding key/value objects to a map
Putting items into a queue, set, or list
Sending a lambda functions to another server
Processing an entry within a map
Locking an object
Sending a message to a topic

serialization-diagram-800x364-1.webp

some data serialization languages !

  1. JSON (Java script Object Notation)
  2. XML (Extensible Markup Language)

Advantages !

  1. Easy to Read and simple to understand.
  2. It has strict syntax -Indentation is important.
  3. Easily convertible into JSON,XML.
  4. Most languages use YAML.
  5. It is more powerful when representing a complex data.
  6. parsing (Reading the data) is easy.

Where YAML uses !

  1. Mainly to write configuration files for Docker , Kubernetes etc.
  2. Maintaining logs and caches of the applications.