[Dancer-users] YAML, why?
sawyer x
xsawyerx at gmail.com
Wed Sep 22 22:24:21 CEST 2010
On Wed, Sep 22, 2010 at 2:24 PM, P Kishor <punk.kish at gmail.com> wrote:
>
> > Configuration files, on the other hand, are not meant to be written with
> a
> > programming language.
>
>
> who says so? I use PDL (Perl Data Language), a highly complex and
> powerful software, probably the most complex I have ever used, and all
> its configuration required to build it are done using a extremely
> readable perl data structure.
>
Say most people with a rather extensive experience.
You do *not* write configurations using computer formats. Computer formats
are for computers, human formats are for humans. As long as humans need to
write the file, it should be in human format. It should have as little of
"computer-talk" to actual content ratio as possible. Sigils, quotes, stuff
like that are not recommended to enforce upon the user in the "human" realm
where configuration lives.
This is the same old discussion as "I want to use XML for my configuration
file".
> YAML is a very good and well-kown format for
> > human-readable configuration files.
> >
>
> Again, who says so? citations?
>
This is not a question of "preference" but of correct usage.
Configuration language is more readable than programming language. I don't
see much point in discussion about this, and I won't start looking for
citations. For all I care, you could force your users to write
configurations in XML, JSON or Brainfuck. But if you're doing so you're
making a mistake. This is the same type of mistake as hardcoding data all
over the file instead of using variables. simply incorrect usage.
By the way, you'll see this "user-driven configuration" behavior in other
projects such as Catalyst which I would count as "if it's good enough for
Catalyst, it's definitely good enough for us" because they have *a lot* more
experience.
>
> Besides, who wants human-readable? I want programmer-readable.
A programmer is a user first. Do you read documentation in POD form or some
form that was rendered from POD (text, HTML, etc.)?
Why does CPAN show HTML and not POD? Why does perldoc show text and not POD?
Why does "man" show text and not groff? For this exact reason.
> No
> human reads the config files on a daily basis, but my computer does
> all the time.
It's easier for a computer to translate human-readable configuration 1000
times an hour than it is for a human to translate from machine-readable once
a day. You should make it easier for the user, not the computer.
> I just gave you an example above where a simple
> indentation can cause misunderstanding both to the human and the
> computer.
>
That's an issue of YAML and you're right about it.
YAML was chosen for its strength (being able to specify a LOT while still
keeping it very readable), but it doesn't mean it doesn't have weaknesses
and that is definitely one.
Catalyst solved it using Config::Any but that forces you more dependencies
so it isn't trivial for us.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20100922/4dfd6181/attachment.html>
More information about the Dancer-users
mailing list