Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates


Just wondering whether it's valid to ask questions (on SO etc) about working code e.g. "How can I improve this?", "How would you do this differently"...I'm not sure whether it seems right to ask that sort of question...just to clarify I'm not asking if it is ok to post one line of code and ask how would you re-write this to be Microsoft Office :)

I feel it's a bit different to the "I'm not sure what is going on or what is going wrong" code question or even different to "Is this code performing inefficiently" etc...where you actually require help in understanding the code or figuring out a bug etc

Often it's great to see how someone else would code the solution to a problem or function and seeing people with a lot more knowledge write code (for me anyway) is a great learning tool.

share|improve this question
I always read refactor questions when they concern languages and areas I'm interested to, and find most of them very useful. – giorgian Mar 10 '10 at 8:42
up vote 7 down vote accepted

I've seen a few great questions that concern how people would re-factor something.

However, I'd make sure that the question only talks about a specific task, and make sure to mention something like 'What is the best way to do X?' in the question. Provide your code snippet and ask if anyone knows of a better way to do that task.

At all costs, you don't want to post a plz-fix-teh-codez question. If you can stick away from that, you'll be fine.

share|improve this answer

Since it wasn't mentioned in the earlier answers, I thought I would add that Codereview.SE could also be a potential destination for asking these types of questions. They are not going to be any more open to plz-fix-teh-codez questions than the SO community, but soliciting advice about real code that is what that site was designed for.

share|improve this answer

If the code is pretty self-contained and not very long (like more than 100 lines), I think it is perfectly fine.

share|improve this answer
Negative. Chacha's got it right: it is about focus. "This codes has this specific problem and I'm not sure what to do about it." is good. "Hey guys, can you make this better?" is bad. The former (if correctly titled and tagged) can help other people later on, the latter is just asking people to do your work for you. – dmckee Mar 10 '10 at 5:40
@dmckee, I agree with you on that. I do tend to believe there are codes which work but somehow you feel there are better ways to implement it. Not really a problem or bug. – o.k.w Mar 10 '10 at 7:58

You must log in to answer this question.

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