Why YAML?

Discussion in 'Bukkit Help' started by Window, Mar 9, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Window

    Having had a hmod server with multiple plugins, I've gotten accustomed to editing config files and doing everything on the fly. However, when switching over to Bukkit, I was disheartened to discover that the simplistic approach had been swapped out for something which immediately didn't make much sense to me.

    So, after having tried to use the YML config format and struggled quite a bit (even with parsers validating my input), I asked myself the question why YML at all? What's the benefit of this? Why not something simpler and more easily editable and quantifiable like XML?
     
  2. Offline

    Plague

    Better human readability I guess, also a simpler parsing algorithm.
    The automated plugin system Fill was to use it, that's the origin from what I've read.
     
  3. Offline

    Tottely

    Have you looket at simpleservers group config thats make sense and is alot easier :C
     
  4. Offline

    Samkio

    Human friendly. [​IMG] Makes yah laugh.
    YAML stands for YAML Ain't Markup Language. (Paradox much?)

    But to be honest when you get used to it it's ok, tad annoying for developers (php) but they can deal with it.
     
  5. Offline

    Window

    That's just it, the usage of spaces and the very unusual non-markup syntax is the reason I'm struggling so hard with this, one minute the config will work, the next it'll be completely invalidated by a single misplaced character.

    Really, this takes me back to the time of NT4 days where one missplaced entry would invalidate your DNS/netBIOS tables, it's the same idiotic "atomic configuration" thinking all over again and I'm so surprised that this has become the standard here.

    The reason I'd advocate a markup config manner is the fact that you know where each entry starts and stops, easily definable and easily editable (and it supports most editors for syntax highlighting too). Additionally, your whole config won't crap out because of one mistake and it'll be way easier for you as a user to debug that visually as well as you can use better intentation as well.

    @Tottely, the problem here isn't the particular issue I'm facing (I'll get this working somehow), but the mere fact that YML itself is a surprisingly inflexible choice in terms of config file editing.
     
  6. Offline

    nerdnosyd

    That could be said about any and all languages. At first, the yml files (or as I call them, yambla files) looked confusing and daunting and raged hard at how terrible they are. But after using them and such, they are very pretty to look at and aren't all that bad. I won't say they're the greatest thing in the universe but I personally don't know of any better way. Some folks have suggested XML files, but, really? XML? Just... no. You can't honestly tell me that this:
    Code:
    <!--HigherExplosives XML Config Mockup-->
    <Configuration>
        <Explosion Yield="0.9" />
        <Entities>
            <Creeper fire="true">
                <RadiusMultiplyer>
                    <chance="0.01" value="3.0" />
                    <chance="0.04" value="2.5" />
                    <chance="0.05" value="2.0" />
                    <chance="0.05" value="1.5" />
                    <chance="0.60" value="1.0" />
                    <chance="0.10" value="0.5" />
                    <chance="0.05" value="0.2" />
                    <chance="0.05" value="0.1" />
                </RadiusMultiplyer>
            </Creeper>
            <TNTPrimed fire="false">
                <RadiusMultiplyer="1.5" />
            </TNTPrimed>
            <Fireball fire="true">
                <RadiusMultiplyer="1.0" />
            </Fireball>
        </Entities>
        <Version="1.4" />
    </Configuration>
    
    Has less of a chance of going wrong due to mark up errors as this:
    Code:
    everyExplosion:
        yield: 0.9
    entities:
        Creeper:
            radiusMultiplier:
                - {chance: 0.01, value: 3.0}
                - {chance: 0.04, value: 2.5}
                - {chance: 0.05, value: 2.0}
                - {chance: 0.10, value: 1.5}
                - {chance: 0.60, value: 1.0}
                - {chance: 0.10, value: 0.5}
                - {chance: 0.05, value: 0.2}
                - {chance: 0.05, value: 0.1}
            fire: true
        TNTPrimed:
            radiusMultiplier: 1.5
            fire: false
        Fireball:
            radiusMultiplier: 1.0
            fire: true
    version: '1.4'
    
     
  7. Offline

    Window

    It doesn't look pretty, but at least there you have the tags to let you know where the data goes and where the data field begins and ends. With YML you don't have any visible separators like that which makes it harder to catch errors. Sure, I'll bet you could go completely overboard and use and editor that shows printing characters, but that's where I'd personally hop off the train due to too much work.

    And that's my point, using YML isn't easy and editing config files has to be easy or people won't use bukkit, I don't know about you, but spending an entire night editing long config files in an obscure format isn't exactly what I invisioned Bukkit to be.
     
  8. Offline

    nerdnosyd

    So instead of the forums being full of, "did you use spaces or tabs?" they'll be full with, "did you properly close the tags?" XML files just seem to have a lot of redundant typing: everything has to be open and closed, there's a lot of brackets, slashes, equal signs and quotes, and it really looks messy whereas yamble files, you just put in the data and move on. Given the two options, I'll keep my yambla files, thank you. I'm not saying that is the best solution or the only solution, it's just one that I personally know and of all the options, I like it the best. I mean I guess every plugin author could write config files in the manner they see fit, but then we have 20 different authors with 20 different views on what a config file should look like and when I think of the nightmare that could ensue, I, again, prefer to keep my yambla files.

    I think the biggest problem right now is the mess that is the permissions system. My server is going to be using multiworld extensively and the permissions for which are going to be a giant pain in the ass to setup. And then there are the plugins that either don't use permissions enough or have way too many permission nodes. And to top that all off, it's all temporary until the fabled Bukkit team release their own. There really, really, really needs to be a GUI for that stuff, one that looks at the plugins, finds its permission nodes and descriptions and shows the users, "Hey this plugin has these nodes that do this, drag them to the user or group that you want to have access to it." That way, users don't bork up important config files that could end up being a couple hundred lines long.

    But I doubt we'll ever see anything as intuitive as that.
     
  9. Offline

    Plague

    You see the problem is not YAML/XML/whatever, the problem is people doing something they do not have skill for :)
     
  10. Offline

    petteyg359

    Truth.
     
  11. Offline

    JedMyre

    Yet another markup language

    that blows up in your face because you left some extra whitespace in.

    Actually I like the readability of YAML, definitely over the tag hell XML would be. I use notepadd++ (windoze) so I can see all the chars explicitly.. regular notepad just won't cut it unless you are super anal, I mean super skilled
     
  12. Offline

    Window

    If by skill you mean patience yes you're quite right. With Hmod, I could setup fairly advanced permissions systems with a tenth of the work required in Bukkit, the reason was that those config files were way more user friendly than this, yet they still offered the same degree of granularity. I'm fairly sure that I'll get the hang of YML eventually, but I still feel that readability is a very poor excuse for introducing such a cumbersome configuration format.

    I fully agree with Nerdnosyd that there has to be a common format and a GUI as that would drastically simplify configuration and allow more people than die hard YML fans to configure their servers. But until this becomes reality server configuration is restricted to those truly dedicated people that like typing more in console windows for the novelty factor than actually getting any work done.

    The feeling I'm getting from YML is that it's some devs pet format that they wish to propagate onward and that it was just chosen with that in mind. Sure, I'm not saying that XML is the way to go, I'm just pointing out that editing config files used to be a hell of a lot easier and I'd like to have kept that way when I moved to bukkit.
     
  13. Offline

    Plague

    No I actually mean basic reading and writing skills.
    There are 3 basic rules to YAML:
    1. You have to indent
    2. Indent by spaces
    3. Do not put spaces before the dividing colon
    Anything else is just basic syntax, like what the | means, what - means etc.
    That's it.
     
  14. Offline

    TnT

    Those are 3 rules users who have never seem YAML do not know, and will be running into problems with.

    A flat file format I can use perfectly fine doesn't matter. The flat files should be simple enough to be able to be edited by anyone using a basic text editor. While I may be disagreed with here - a person who has a basic knowledge of administrating a system should be able to edit the config files without too much problem.

    Until working with Bukkit here, I have never once - in my 10 years as a server administrator - needed to work on yaml files (that I know of). I administrate Windows, Linux and VMWare ESXi servers (my point is that I have handled a wide range of systems). Its not something everyone needs to do - so its going to trip up a great many people, not just noobs. Skilled admins will be able to figure it out, but I'm concerned with the sheer number of posts that hit the Discussion and Help forum due to yaml being used for config files.
     
  15. Offline

    Plague

    And also three rules that are found out by any search for "permission problems" thread and/or reading Wiki:
    http://en.wikipedia.org/wiki/Yaml#Syntax

    But that should not stop plugin developers using YAML from giving a freaking howto or a proper link to syntax examples to their plugin release threads.

    You are also right that I saw YAML first time here. And that was only for the plugin.yml since I never used permissions. Bu I prefer YAML to XML for this little plugins we have here.
     
  16. Offline

    Jonbas

    I don't think this is a problem for individual plugin developers to need to tackle every time. This really comes down to the same nightmare that this entire system is facing: documentation.

    We really really need some basic how-tos for all of this.

    I'm currently in the process of converting a hMod server with 300+ registered users over to bukkit, and let me tell you, it's a freaking nightmare. I've spent hours, and hours, trying to sort out the new permissions nodes that each user/group needs and writing scripts and programs to automate the conversion of key databases and files.

    Using yml in the permission system is going to be a real challenge for administering users going forward. I'm having nightmares about delegating that to someone else and having them crash the server every time they slip. I'll probably have to write another plugin just to automate and try to error proof the process.
     
  17. Offline

    clash

    When I first say YAML, I thought it was weird. Then I thought of Python's indenting. [​IMG]

    When I saw how easy it is to get/set configuration hierarchical data via bukkit's Configuration object, I was sold. I guess a similar API could be written on top of an XML file, but blah. Editing XML is no fun either. Just more lenient with whitespace.

    I've used Java properties files with keys like "this.that.something.value", but the organization of the file quickly gets out of hand. And writing the file jumbles everything up. [​IMG]

    Anyway, I think the best compromise is (as mentioned above) documentation (of which there is plenty on YAML), and for plugins to provide default, commented configurations (which many do), and even providing in-game commands for changing settings is cool, too.

    Blunt, but often true. [​IMG]
     
  18. Offline

    TnT

    Personally, I think the only documentation a person should need when editing a config file is knowing what values to enter in that config file. It should not have to require the user to learn how to use that config file format first - using it should be a no-brainer (stupid easy).

    To us, it may be easy. That doesn't mean its easy to use.
     
  19. Offline

    petteyg359

    Easy and good are often mutually exclusive.
     
  20. Offline

    Plague

    Well, but users needing a stupid.easy config files should not become admins, ever ;)
    And as I stated peviously somewhere, google will teach you to use YAML in no-time really. It's all about wanting to help yourself, which should be admin's first skill to master.

    And to say why I'm on the side of YAML here: I personally made parsers for config files and encountered many different formats for config files. So I think my statement will have some firm ground. If you want simple configs, they will either be badly readable or non-versatile. If you want versatile and readable ones, then the USER has to take some more work. And since the user is an admin, he should be able to do so.
     
  21. Offline

    TnT

    What should and should not happen can be debated for years. What WILL happen is those users who need stupid easy config files will flood the forums with not having any idea how to edit the file (already the permissions posts are 50% of the posts on the Discussion and Help forum, and a great deal of those are due to editing problems).

    The more complicated the config file becomes, the more problems will hit the forums. I honestly don't care which format is used as long as it doesn't generate as many problems as I've seen on the forums so far - and I'm not sure you'd disagree with me there - I've seen (felt?) your rage at some of those users.
     
  22. Offline

    Plague

    It's true that shoudl permissions use a more easier format, the forum would be much much much cleaner (or maybe add one "much" more there).
     
  23. Offline

    Jonbas

    oh lord. now users are requesting me to turn my 5 line plugin.properties file into yaml...
     
  24. Offline

    mjmr89

    YAML is fine... I'm just wondering why it's so difficult to make it check for 4 spaces OR tabs. I don't know how it does it internal, but it doesn't seem too difficult to check for tabs instead of spaces, or both. Can someone enlighten me? It just seems like a really arbitrary problem.
     
  25. Offline

    Killie01

    i like XML but yeah that's a personal feeling
    i don't use any group systems because i don't like the YAML stuff
    i think it looks horrible
    but all good friends i am not the one making choices for it :)
     
  26. Offline

    maxx001

    I would also choose XML any day over this YAML nightmare. It is stupid to use a format that depends on position and indentation and not even supporting tabs.

    XML has the clear benefit as already stated that you know exactly where your data goes.

    And for those who complain about opening/closing tags, you also complain about curly braces in java?

    Life would be so much better if permissions was handled by robust XML files instead of this YAML!
     
  27. Offline

    XeonProductions

    I really hate how unforgiving YAML is, you people are a bunch smug bastards. XML, although less readable to humans, is much more forgiving when it comes to small errors.

    inb4 DERRRRRRRRRP, NOTHING IS WRONG WITH BUKKIT, YER JUST DUMB!! GO DIE IN FIRE!!
     
  28. Offline

    Killie01

    always like to do that??

     
  29. Offline

    Window

    I shouldn't have mentioned XML at all as everybody completely misunderstood my point in that regard. XML was just an *example* of another configuration method, I those that because most applications I've seen are using XML as an intermeditate formation for data transferrance between differing formats. Personally I would have opted for simple configuration files with value=blahblah which is way easier to use than XML in comparison.

    And as others have pointed out, the intendtation and unforgiving nature of YML config files is the reason why it isn't an optimal solution. So far the only remotely technical merit I've seen in this thread to defend YML is the fact that it's more readable over competing formats.

    So if we compile a summary between YML and XML and simple config files, we have the following to go on:

    YML:

    - Invalidates entire config with one missed/misplaced character
    - Requires usage of characters which aren't visible to the naked eye (unless you get an editor that supports viewing said characters)
    - Requires information on proper formatting before user can properly utilize it, ie, learning curve exists
    - Is an uncommon configuration format
    - Requires specific indentation practices

    + Has high readability

    XML:

    - Requires prior knowledge of HTML editing
    - Errors can cascade through commands, making troubleshooting issues hard
    + Invalidates only single commands that are faulty
    + Can be indented in any way the coder chooses for customized readability
    + Is well known and wide spread in terms of formats
    + Most people know HTML from school, that makes editing XML files easier.

    Simple text file with documentation in comments:

    + Does not require any prior knowledge of editing formats or practices
    + Does not require indentation
    + Enhances readability as no tags or special characters is needed
    + is used by pretty much all the major game publishers like say Valve, EA and Gearbox

    - Not a fancy format that you can use on your resumé when you're applying for a job as a coder/server admin
    [MERGETIME="1299945394"][/MERGETIME]
    I'm sorry, but Plague above already wrote that, so you're too late ;)
     
  30. Offline

    zolcos

    Man, what was ever wrong with INI?
     
Thread Status:
Not open for further replies.

Share This Page