I've noticed that in code related questions on GIS SE, particularly OpenLayers / Leaflet / JavaScript ones, that new people are not posting up any code examples.

The example that prompted this question (one of many though) is How to deal Leaflet map control checkboxes?

This doesn't seem to be as much of an issue on StackOverflow, so I'm wondering how best to prompt users to write code. I will be up front, I don't spend much time on StackOverflow, so I'm not sure whether they have procedures in place to help with this issue.

I've noticed that the FAQ doesn't mention anything about code samples for code questions, would this be a worthy addition?

Jon Skeet has given some excellent advice to asking good programming related questions. Perhaps another inclusion into the FAQ?

Also if the code is JavaScript related, a jsfiddle is a MASSIVE help in solving a question.

Even something like a canned response to give as a comment would be helpful.

Any ideas on how to alleviate this issue, if you see it as an issue?


1 Answer 1


To encourage users to post code, the community now (four years after the question was asked) seems comfortable voting to close questions about code whenever they do not contain a code snippet that illustrates what has been tried and where the asker is stuck.

Along with the tool for performing those closures, we try to provide copious comments and edits to improve the questions of new users, and we also try to teach them how to write clearer coding questions by providing a Meta Q&A about Writing code snippets to get quicker answers?

The reason for placing questions on hold is so that they may be improved quickly by their askers (or any editors), rather than leaving them wondering whether they really need to.

A vote for On Hold, used appropriately, is the most powerful driver we have to achieve quality questions that receive quality answers quickly.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .