I have often been bitten by this issue (and i see many other people are), if I try to put in everything that is usefull, i got complaints nobody could read all of that, if I only put in a couple of snippets of what i thought was the relevant code, I was informed I was missing all the usefull bits.
Ideally, you should provide an SSCCE that has just enough code to demonstrate your problem, so that others can simply copy, paste, compile, run, and get the same results as what you're seeing (or just compile and get the same error, if that's the problem you're having), but no more. Often this will mean that rather than providing a snippet from the project you're working on, you will create a new program, just for the purposes of demonstrating your problem with no extra clutter.
May way of doing: Firstly I would try to isolate the problem by trying to implement/reproduce in a simple program that way I can remove all the noise. May be after doing this I would be able to solve the issue myself, if not then post the simple program on the forum for help.
There might be times when I dont have patience and end up posting lot more code. But if at all you fail to post the correct code then you always get inputs from other members- whether to post more code or remove excess code. Because a third eye would be able to spot the issue much quickly then the two eyes which have been seeing the issue for long time and yet unable to find the issue.
Mohamed Sanaulla wrote:May way of doing: Firstly I would try to isolate the problem by trying to implement/reproduce in a simple program that way I can remove all the noise.
Indeed. And this is important: If you're doing your investigation and debugging right, you should already have an SSCCE even before you decide to post to a forum. When something is not behaving as you expect, and you can't figure out why, one of your first steps should be to isolate the misbehaving piece (or a smaller, simpler equivalent) and try to understand how it behaves in isolation. As Mohamed points out, this will often lead to you solving your own problem, but if not, it means you're ready to provide the forum with something that is more likely to be useful for the people there to understand the problem and suggest a solution.
Looking at things in small, isolated pieces is a High Holy Writ of software development (and many other types of research and experimentation as well).
We have posting guidelines already, which include things like “Isolate the Problem”. The “Post Real Code” page there, for example, has links to sites about SSCCEs.
We usually discuss questions about questions on a different forum, so I shall move this discussion. It will remain “visible” in this forum, however (I think, for one week), and may remind new posters about those guidlelines.