[openbeos] Re: decoder config options

  • From: Alexandre Deckner <alex@xxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Wed, 20 Feb 2008 23:41:04 +0100

Gabriele Biffi wrote :
Alexandre Deckner wrote:
I've always been thinking about the binary/gui vs text config file question, from the programmer and user perspective.
I've accumulated some random thoughts :)

Please let me do some corrections to your thoughts :-)
Hehe, that's what mailing lists are for :-)

3) + it allows comments / examples / documentation directly in the file (although plain english ascii can be limiting)

Not exaclty. We are UTF-8, we can write in any language.
Well i didn't want to emphasize on english or encoding (although text config files can't practically be multilanguage), but on text, which cannot express everything clearly (think graphs, images, colors).

5) - it is hard on the programmer side if you need more than a couple <name,value> pairs. Checking the data for syntax and semantic errors can be difficult.

Not exaclty. Checking for semantic is easy and you've to do it even with binary files. The syntax check can be done by a common loading function, if Haiku (or some library) has one.
You're right, there's not much difference between binary and text, and i agree it's not necessarily hard. But i was thinking to reduce to a minimum the amount of code to write for either the configured app or the pref editor/window. This would need to add additional (meta?)information (ex: typing) to the file data, and that would really encumber a plain text file (even an xml one).

Wait - there shouldn't be a need for a separate config application at all! All the configuration should be done inside the application itself. But if we stick to a common format, the power user can use a generic editor (and if we use text files, we don't need one at all, but we can still make one if we want).
Yes yes, we agree. When i say editor, i think of a common ConfigView a la HtmlView that would be easily integrated and extendable in your app, or in a separate app.

4) + contrarily to plain text, your changes are always valid, the user interface is here to enforce that.
> 5) + it can be easyer on the programmer because he can use brute force,
> object/message dumps, and you are sure the data is conform due to 4.

Not really. A binary file can be altered via a binary editor or otherwise damaged, so you still have to check it.
Sure it can be broken, just as the program binaries or text files, but a normal user is less likely to use a binary editor. Anyway i'm thinking "reducing code duplication", and integrity checking should be done by common code, be it text or binary. The difference is that you can't cleanly hide private/implementation data in text files.

I think that the best way to go are text files (easier for the user), and a set of functions to make them easy for the programmer as well.
Sure, i use them every day, xml too, but i've seen so much code (and wrote some, not Haiku in particular) redoing basically the same tedious work differently each time because there's no ultimate nor standard practice now. And there's some reason this discussion started after all :-)

Regards,
Alex

Other related posts: