This question was recently closed as being not constructive:

How do I convert domain.com/foo/bar/baz/ into a string like 'foo bar baz'?

The author shows us the approach he is using, says it's "less than optimal," and asks if there is "a better way."

The wording is a bit vague, but it's still pretty easy to see that the OP wants suggestions on alternative ways to accomplish this same task. Maybe he wants to optimize for size or optimize for performance, maybe he just wants to compare his options and choose the best one.

The question was closed as being "not constructive," giving it a boilerplate note reading:

This question is not a good fit to our Q&A format. We expect answers to generally involve facts, references, or specific expertise; this question will likely solicit opinion, debate, arguments, polling, or extended discussion. See the FAQ.

This is confusing to me because:

  1. This simple question about munging strings clearly invites factual answers rather than opinion. It only received factual, objective answers; none were opinionated.

  2. Specific reference to an article by an expert was given in one answer.

  3. No opinionated statements were made; no debates, arguments, or polling took place.

  4. Extended discussion did not arise. None of the comment sections need to be expanded to read them in their entirety.

In fact this question seems to satisfy all of the requirements for not being "not constructive," Clearly there is something I am missing. Can anyone explain why this question might be considered "not constructive?" The only justification I can think of is that it could be seen as too specific to be generally useful, or that optimizations questions are not welcome, although I don't agree with those points of view.


Words like "easy" and "better", in my experience, cause people to blindly vote to close otherwise innocuous, simple, specific questions like the one you cite as not constructive.

Oh well, I reopened it. I should take a break now. Great answer, by the way! It's people like you who help keep the quality bar way up high on SO.

  • 1
    Works for me. And thanks, but you're probably giving me too much credit :) – The Community Feb 13 '12 at 18:16
  • great verdict @BoltClock's a Unicorn and nicely raised question GGG at the right time – Devjosh Feb 13 '12 at 19:07

I would agree with Bolt's suggestion, that subjective words like "easy", "better", etc. make it more likely to be marked as non-constructive, unless the OP is looking for specific information (which they have to explicitly ask for, in well-defined terms).

Generally, I find that when people ask "I'm doing [...] is there a better way?" without also specifically defining what "better" is in their mind (performance, memory footprint, easier to read, comparison against a specifically mentioned coding standard), the question amounts to asking for advice/improvement vs. asking for a correction/fix, which makes the question less clear. The difference being that if the code works properly (gives the proper output given the input) then, while the code might be able to be improved, it's not necessarily wrong.

codereview.stackexchange.com - on the other hand - is great for these sorts of advice-based questions.

In these cases, steering the OP to a fundamentally better question (or editing it yourself as a way to steer the OP) is sometimes the best approach. That is, ask them to define the murky parts, point out where it's not clear what would count as a "correct" answer, and/or vote to move the question to somewhere else (e.g. codereview). If none of that, you feel, is appropriate given the situation, then you can either edit it to limit the scope of possible correct answers in a way that doesn't destroy the original question, or vote to close.

  • I see that you don't have a CR account, I assume you don't participate there much... do you browse it often? If so, do you like to see questions like this there? – The Community Feb 13 '12 at 18:48
  • Oh whoops, I see you do have an account there, I missed the "see more" link. The rest of my question still stands ;) – The Community Feb 13 '12 at 18:56
  • When I'm on CR it's more about mentoring and advising, rather than fixing errors or explaining system details. I think I'm using CR as intended, but that's my personal approach. At work when my code is reviewed, that process tends to be the time that I get questions and guidance about issues such as style, efficiency, correctness, and things like, "You can do in 1 line, what you're currently using 3 lines of code to accomplish," or "Did you know that concatenating Strings this way is 50% slower than method [x]?" As such, I tend to prefer reading and answering advice questions on CR. – jefflunt Feb 13 '12 at 19:41

I think that the question would be more suited to codereview.stackexchange.com. From its FAQ:

What kind of questions can I ask here?

Code Review - Stack Exchange is for sharing code from projects you are working on for peer review. If you are looking for feedback on a specific piece of code from your project in the following areas…

  • Code correctness
  • Best practices and design pattern usage
  • Security issues
  • Performance

then you are in the right place!

This question is looking for feedback on a specific piece of code regarding performance of said code.

Given there's a targetted site for this kind of question, it better belongs there. It should probably be moved over there instead of closed on SO.

  • Oh man please don't start sending this kind of stuff to CR... I'd argue that since there is really just one question and just one answer, it's a better fit for SO. I personally like to see nice big chunks of code on CR, or at least a function or two, not little one-liners that can be answered with a sentence or two. Also I think this particular Q definitely falls under performance and probably best practices as well. – The Community Feb 13 '12 at 18:18
  • I don't see any sort of code size limit in CR's FAQ. CR is for code reviews. One line of code is still code that can be reviewed. – CanSpice Feb 13 '12 at 18:27
  • Hmm.. so if I made a meta question "Are questions with non-broken code a better fit for CR than SO?" ... how would you answer? If I saw code review requests on CR that contained only enough code that a single question could be asked about it, I'd be more inclined to send them to SO if I had the power to do it. – The Community Feb 13 '12 at 18:38

You must log in to answer this question.

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