DEV Community

Cover image for Start Using Yaml Files
NightBird07
NightBird07

Posted on

Start Using Yaml Files

Yaml stands for "YAML Ain't Markup Language". It is a human-readable data serialization language that is commonly used to describe configuration files. Some of the benefits of using Yaml are:

Easy to read: Yaml files are easy to read and edit by humans. They use indentation instead of brackets, and colons and dashes instead of equal signs.

Flexible: Yaml supports lists, objects, strings, booleans, integers, floats, null. It can represent complex data structures in a clean format.

Language independent: Yaml files can be parsed and emitted by programs written in any language.

Configuration files: Yaml is a popular format for configuration files. Many applications like Kubernetes, Ansible, and Github Actions use Yaml for their config files.

Model libraries and UML diagrams: Because Yaml has a simple syntax and can represent complex data structures, it is useful for modeling libraries, architectures, and even UML diagrams. The indentation and formatting make the models very readable.

and here is my journey of living with one of the huge libraries ever. Libpg.h though the header file of the libPg is enough to see the available procedures but still you need to give more hints and make it easier to recap the functionality or notes for a specific function.
I started to write YAML files for each function and then connected these files in a UML representation you can actually do similar thing in your local machine with yml2dot and then olaaa you got a visualization of your documentation.

Top comments (6)

Collapse
 
luccabiagi profile image
Lucca Biagi de Paula Prado

Well definetely theres some pros, but, the main con is when you have really big yaml's. Debugging it will be hard and most of time, the problem were caused by wrong indentation.
Personally I prefer .properties files.

Collapse
 
nightbird07 profile image
NightBird07

it is the new school of coding indentation is not a problem any more

Collapse
 
luccabiagi profile image
Lucca Biagi de Paula Prado

What do you mean by "it is the new school of coding"? And why it isn't a problem anymore?
As any ide will figure out which is the right indentation for a line, they definitely help, but not solve the whole problem.
I suggest looking in this cool website:
noyaml.com/

Thread Thread
 
nightbird07 profile image
NightBird07 • Edited

"It is the new school of coding" refers to the modern trend of using indentation for code structure and readability.

Indentation is not a problem anymore because IDEs automatically handle indentation.

IDEs assist with determining correct indentation, but they may not solve all indentation issues.

Thank you for the suggestion! I will check out the website

Thread Thread
 
luccabiagi profile image
Lucca Biagi de Paula Prado

Fair enough! Thanks for the explanation!
Even though I'm criticizing yaml, I liked your post as it shows different uses for it, I've just used for configs, so I liked a lot to know about yml2dot!

Collapse
 
sehgalspandan profile image
Spandan Sehgal

I didn't knew this much about YAML files. Now that I know, I will try them out.