Docs in wiki confuse static and non-static syntax

Issue #536 wontfix
Gerard Ryan created an issue

Hi there! I was using this project for the first time and was following the docs in the wiki. They’re really good (although I think a Javadoc page would be useful somewhere (I couldn’t find one linked)).

Anyway, one thing that confused me a little in the content was that in some sections, there’s an introductory sentence that seems to indicated that some particular methods are static, but then one would have to read the more detailed example code to realise that they’re not.

E.g. here:

The Yaml.dump(Object data) method accepts a Java object and produces a YAML document.

but then:

public void testDump() {
    Map<String, Object> data = new HashMap<String, Object>();
    data.put("name", "Silenthand Olleander");
    data.put("race", "Human");
    data.put("traits", new String[] { "ONE_HAND", "ONE_EYE" });
    Yaml yaml = new Yaml();
    String output = yaml.dump(data);
    System.out.println(output);
}

In that example, in the original sentence, it might be clearer if the snippet was new Yaml().dump(Object data).

Since this is in the wiki, I don’t think it’s something I can make a PR to propose a fix (or maybe I’m just not used to Bitbucket).

Comments (3)

  1. Gerard Ryan reporter

    Possibly, but one could say the same about the more detailed example, right?

    Maybe another approach would be to instead say yaml.dump(Object data) in the initial sentence: that would be another way to convey that .dump(data) should be called on an instance of Yaml, rather than on the class itself.

  2. Log in to comment