|
But if you went to QA to read his question, you wouldn't find it, because it's here.
It's a catch-42*.
* Which is at least 20 bigger than the 22 variety.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
It has always been advised to put a code example in your programming questions. I used to think it was a good idea, because how else can you make sure that potential answerers really know what you're asking a question about.
But I'm not convinced anymore. At least not for every type of question, some questions are inherently about some piece of code so it had better be there. But what I'm seeing a lot is that someone asks a general question, includes example code because that's what you have to do to ask a "good question", and then everyone jumps on irrelevant details of the example. Bonus if OP changes the example (to remove the unintended problems with it) and then gets blasted for making the answers irrelevant (they already were, but no one could look any further than the code on their screen).
Especially for C/C++ (inb4 "not the same language" - no, but similarly broken and the communities act the same) questions, where the example has some unintended UB in it (because all C/C++ code has UB in it) that is unrelated to the question they were trying to ask, and everyone jumps on the UB instead of the actual question. But it applies in general.
So including a code example is not always a good idea.
modified 26-Feb-17 7:28am.
|
|
|
|
|
I'd say that most questions should have code - the ones that omit it generally are the "do my homework for me" merchants and Help Vampires.
If nothing else, having to provide relevant code focusses the OP's mind on the actual problem and - in my case at least - means you can see the solution without posting the question. And proves that you have genuinely tried something!
But ... if you post code, it should be relevant, correct, and capable of compiling. It would be nice if it demonstrated the problem as well, be we can't expect miracles from some people.
If it doesn't compile, then generally it's not the code they are actually using because that would be copy'n'paste so it's pretty much useless anyway.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
harold aptroot wrote: So including a code example is not always a good idea. Not including one is worse. I'll assume you did not even try to write code, or cannot find the appropriate commands to copy and paste
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
But there is nothing to try, it's a general question. Any example would be artificial.
|
|
|
|
|
I'd have to see an example of that
Sometimes the question is as general as "how do I save stuff". One way of asking for more details and context is by asking for an example of what they are trying to achieve.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Any example I give here would make people miss the point..
But whatever, let's go for it.
OP wrote: How does x & -x isolate the rightmost set bit? For example in C:
int rightMostBit(int x) {
return x & -x;
}
Tags: [two's complement arithmetic]
Typical reply:
Oh boy, negating an int in C? Can't do that, it might be INT_MIN and then negating it will bring about the apocalypse. Actually even ignoring that for a second, what if it's not a two's complement negative but something else, with one's complement negatives you'd just get zero and with sign-magnitude representation you'd get abs(x) . See, it doesn't isolate the rightmost set bit in the first place.
All of which is (as far as I know) true enough, but irrelevant to the question.
|
|
|
|
|
The problem is when the question is unclear (mostly I see problems with English), and you try to understand it from the code - which may be largely unrelated... In this case talking about the code - that does not compile - is possibly irrelevant, but you left with nothing, else... For me it is a way to communicate, in case when English (mine as well) is insufficient...
A 'good question' is not about adding code to the text, but writing good text and adding relevant code...
So IMHO, adding code or not is not for the OP to decide, but more for the one who try to answer if to use it or not, and how...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Many of the problems you have described have arisen because there are many regular 'contributers' who insist on jumping in and answering questions they do not understand (because they are unclear). One jumps in and others follow. There is a comments mechanism which is designed specifically for obtaining clarification. This is under utilised. In the real world as opposed to the Q&A these types of responses would be met with derision. Instead they garner support from various acolytes (regulars) who often upvote each others non-answers leaving the OP wondering what has happened. Code in my opinion is always good and if it is not clear a polite comment is all that is required.
Peter Wasser
"The whole problem with the world is that fools and fanatics are always so certain of themselves, and wiser people so full of doubts." - Bertrand Russell
|
|
|
|
|
The other problem is that some people go "it's not clear, let's close it" (often with a rude comment) instead of trying to understand it, or ask / wait for clarification. OK, we don't get as much now that He Who Must Not Be Named has gone away - but it's still not helpful to anyone.
And sometimes, if you think outside the box you can work out what the OP is trying to ask...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
OriginalGriff wrote: He Who Must Not Be Named has gone Hm...hm...hm...
He is here... But only to writing articles... You do not see because he needs not our approval...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Don't tell me, half of 'em are "see my other article, it's much better"
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
This is exactly my point.
OriginalGriff wrote: And sometimes, if you think outside the box you can work out what the OP is trying to ask...
If the OP confirms "Yes that is what I was asking" then answer. Answers simply based on what the respondent thinks the question may be often go astray.
OriginalGriff wrote: ome people go "it's not clear, let's close it"
Yes this happens but a question can't be closed (under normal circumstances) by one user - or can it?
Peter Wasser
"The whole problem with the world is that fools and fanatics are always so certain of themselves, and wiser people so full of doubts." - Bertrand Russell
|
|
|
|
|
OriginalGriff wrote: He Who Must Not Be Named has gone away There was an OP who lived?
|
|
|
|
|
Yeah, but ... the scars man, the scars ...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
harold aptroot wrote: then everyone jumps on irrelevant details of the example
I see this a lot with SQL issues. Someone will paste sample code and rather than answer the question people will post solutions to their SQL injection vulnerabilities. I see nothing wrong with raising these issues in addition to the solution to their actual problem, but some people seem to not mind talking about the SQL injection and nothing else.
|
|
|
|
|
Nothing wrong with pointing out a SQLi vulnerability in a comment, or as part of an answer that tries to address the original question.
And in some cases, fixing the SQLi will also fix the original problem.
But if it doesn't address the original problem, then it's not an answer.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
I've seen what you are talking about. Especially when the asker is non-English speaking and the question takes some minor skill at deciphering what is being asked. I have done that deciphering and answered the question that to me was obviously being asked. The questioner thanks me but others bitch at me for "enabling" such poor question asking. And I'm like "WTF? Aren't we all here to help each other?"
#SupportHeForShe
Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson
You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun
|
|
|
|
|
Some people are jaded and equate poor English skills to bad questions when that isn't always the case[^]. As you said, if it's a good question and you can understand what they mean why not help?
|
|
|
|
|
I agree. Another problem is the drive-by 1-stars if someone doesn't see code or doesn't understand a problem. For example, this[^] was down-voted twice before I even read it despite it being A) obviously not homework, and B) a relatively well thought-out question. He had done preliminary testing, included results, stuck to relevant facts, and didn't include code that ultimately would have been pointless and/or misleading.
|
|
|
|
|
Personally, I would prefer a question with code example to better help me understand the problem. Sometimes, language could be a communication barrier, if I don't understand the question, I can look at the code and make an assumption.
Money talks, but sometimes code talks too!
I'm sure all CP members have a good intention, to help the community. Some like to provide solution, some like to provide suggestion, some like to provide guidance, some like to vote, some like to lecture, etc... But, hey, we're all human and behave differently.
Bryian Tan
|
|
|
|
|
Yes. I hate it, especially on StackOverflow, when I post a well composed, accurate, and general description of what I've trying to do, and what happens. "Code! Code!" the masses cry, and my neat question turns into an infinite scroller after including the code and all its context.
|
|
|
|
|
Why it takes so long | CommitStrip[^]
If it takes a few moments to do, engineer wouldn't heard about it until day 10... If it takes more time not until day 30...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Quote: LOS ANGELES (Reuters) - The death of a world-class magician found hanged in his dressing room at a popular Hollywood nightclub called the Magic Castle was ruled an accident on Saturday by the Los Angeles County Medical Examiner's Department, an agency official said.
But the coroner who performed the autopsy on Saturday ruled the death an accidental hanging, said Lieutenant David Smith, the medical examiner's watch commander for the day. He said the finding was that the hanging was self-inflicted, though it was not ruled a suicide, Smith added. [^]
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
|
|
|
|