I see this as two questions: What is 'good' documentation?
...And:
'Why do users come to Stack Overflow, even when I can show them good documentation that answers their question'?
There's no short answer to that, so take a moment to read a long one:
Manuals and documentation in general are written for more than one audience, and often they must be 'split out' into separate documents.
I'm going to explain this using the example of a typical piece of commercial software, rather than for programming in general and the particular questions asked by developers on Stack Overflow, because it allows me to lay out the principles and the categories of information in a structured way. Nevertheless, these principles hold true for notepad.exe or for the vast and complex world of developing applications in Java; the differences lie in choosing which category of documentation needs to be prioritised, and how it should be presented.
And, of course, on recognising which developers count as beginners, 'occasionals', experts, and 'support manual' users in terms of how they need to use the documentation. This is not as easy as you think, and it is often done badly: you should ask yourself "Who was the intended audience for this documentation" before concluding that the reason it is useless, to you, is that the authors would have been more usefully employed contributing methane to a landfill gas recovery plant.
You will still be correct in drawing this conclusion, more often than not.
So here's the basic documentation set for a moderately complex piece of software:
Getting Started:
- Congratulations on purchasing ACME software's latest product!
- Here's how to get it up and running;
- These are the three most common task you will perform, with a brief explanation and short set of screenshots;
- Where to get more information (links to help, an example of context-sensitive help, and a link to the full manual);
- Three 'cheat sheets' of menu paths and keyboard shortcuts for the common tasks.
A good piece of 'help' documentation is a searchable 'Q&A' or FAQ page. For much of the world's software, Stack Overflow is all of it; there's no disgrace in SO being the best source of answers for some products, but I have a very low opinion of vendors who are so bad that the 'Stack is the only source.
There is a skill to generating the 'Getting Started' document: it's got to be short, relevant, and memorable.
For simple software, it is sometimes the only documentation that needs to be provided to the user.
User Manual:
A user manual has three audiences:
- Beginners;
- Occasional Users;
- Experts or 'Power Users'.
There is a fourth item, a 'non-audience' of very special users:
I say 'non-audience' because they probably won't read the manual at all, but they are still represented in the 'do not do this' information that protects you against legal liability.
...And your User Manuals have to support two activities:
- Learning to use the application and exploring additional functions after mastering the basics (the 'Training Manual' function);
- Looking up answers to specific questions about the functions of the software (the 'Reference Manual' function).
These two functions aren't really compatible, if you can fit them into a single document at all, you're going to structure it in distinct sections.
Support Manual:
I'm going to deal with this lightly, because there are very few generalisations which can be applied to this.
But the basics are:
- An overview of how the software actually works;
- The location of the error-reporting and debugging tools;
- ...And a worked example of their use;
- An 'FAQ' of the most common user error reports with worked examples of their resolution;
- A suggested 'first line support' script...
- ...And a searchable wiki or Jira-like vendor page of support issues, with details that are good enough to constitute a 'worked example' of each reported issue was resolved or worked around.
Some vendors do this; and some don't. Some vendors supply 'recipe' instructions on what to do, but are very reticent about explanations...
...I would like to think that most of them do.
But, in all cases, Stack Overflow is still the 'go-to' destination for answers, even when better information is available from the 'official source.
Here's why:
The essential concept of discoverability:
I don't need to point out that
both the teaching and reference functions of a manual should be searchable - although the training will lean towards a 'start from the beginning' narrative for some products - but the reference section and the 'Support Issues' list should be
discoverable.
This means that it's not just possible to 'look up' details of the things that you know by name or keyword - 'Looking up the details' means you know what they are, you know exactly what they are called, and you have a pretty good idea as to where the information is, already - discoverability is about finding out what it's called and where it is, even if you're from a different technical background to the authors of the document.
Example: "Oh, I can see that needed the word 'dimension' to do this, not 'table'..."
Counter-example: "Stooopid newbies are expected to know this and they need to spend an afternoon reading the training manual if they don't"
So the short answer to your question is:
Stack Overflow has discoverability.
You can discover answers here that you won't find on other sites, even in the 'official' documentation, because unloved and unlinked information left as look it up if you know exactly what it is and where' isn't 'documentation': it's a digital sarcophagus.
And if you can't discover it by Googling into the site, the 'Stack provides the ultimate discovery tool: asking people who actually know.