Preface

What is YAML? From the specification:

YAML(tm) (rhymes with 'camel') is a straightforward machine parsable data serialization format designed for human readability and interaction with scripting languages such as Perl and Python. YAML is optimized for data serialization, formatted dumping, configuration files, log files, Internet messaging and filtering. This specification describes the YAML information model and serialization format. Together with the Unicode standard for characters, it provides all the information necessary to understand YAML Version 1.0 and construct computer programs to process it.

For Ruby developers, YAML is a natural fit for object serialization and general data storage. Really, it's quite fantastic. Spreads right on your Rubyware like butter on bread!

The possible uses for YAML are innumerable. Configuration files, custom internet protocols, documentation, the list goes on and on. Also, with YAML readers popping up for other languages (see YAML.pm and others), you can pass data easily to colleagues in distant lands, swamped in their archaic languages.

YAML is a beacon of light, reaching out to them all. ;)

If I can (quickly, of course) in the Pickaxe book, an all-time favorite coding book, Dave Thomas and Andy Hunt say:

When we discovered Ruby, we realized that we'd found what we'd been looking for. More than any other language with which we have worked, Ruby stays out of your way. You can concentrate on solving the problem at hand, instead of struggling with compiler and language issues. That's how it can help you become a better programmer: by giving you the chance to spend your time creating solutions for your users, not for the compiler.

HeiL! So true. Ruby's elegance, its readability, its common sense! Such it is with YAML. YAML is completely readable, in fact much of its syntax parallels Ruby's own data structure syntax!

Another one from the Pickaxe:

Ruby is easy to learn. Everyday tasks are simple to code and once you've done them, they are easy to maintain and grow. Apparently difficult things often turn out not to have been difficult after all. Ruby follows the Principle of Least Surprise--things work the way you would expect them to, with very few special cases or exceptions. And that really does make a difference when you're programming.

A quick look at YAML and you can see your data structure immediately. If I compare it to SOAP or XML-RPC, the difference is immense. With XML-RPC, you can see the data structures, but its terribly verbose. More time is spent describing the structure than anything else. Again, the Principle of Least Surprise is wholly present in YAML.