Why do format conversion libraries lack a single method to write the
output to a file?
From my experience with Ruby, libraries that convert a format (such as
YAML, JSON, XML, SASS, etc.) to objects of the language in use often have
a single method that covers from reading of a file to parsing, which are
usually named like load, load_file, etc. (In addition, they usually have a
method that only does parsing on a string that was read in advance, which
are usually named like decode, parse. etc.)
On the other hand, when it comes to converting the objects into the target
file format, such libraries rarely have a single method that covers from
conversion to writing to the destination file. Usually, they only have a
single method that does only conversion, which is usually named like
encode, etc., and the result string has to be written using another method
such File.write.
What is the reason for this assymmetry?
No comments:
Post a Comment