What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

With the overwhelming influx of more and more bad quality code from beginners in tags such as PHP, jQuery, mysql, etc. it becomes increasingly likely that bad code / bad practice is not corrected which means that SO ultimately becomes a distributor/multiplicator of bad code / bad practice which would of course be the opposite of what SO is meant to be.

Some will now tell me that the community should just edit such code. But that becomes increasingly impossible for many questions. Because if you refactor the whole question, the question will become invalid.

I propose a way of marking questions or code snippets with obvious bad practice as such so other beginners can clearly see what is code worth copying/reusing/learning from and what is not.

I think it would be a great improvement for everyone, if it was clear whether a snippet of code is a good example of coding or a bad example.

Edit: In general I agree with Chris' answer but I strongly assume that Chris, not being active in any of the tags I mentioned, does not understand the scope of the problem we're facing in the PHP/mysql tag world.

share|improve this question

1 Answer 1

I don't think there's a need to introduce a new mechanism to indicate bad code - the current mechanisms should be enough to indicate what's good and what's not.

For code in answers you have choices. You could edit the answer but equally you could provide a new answer with "better" code. If the rest of the community agrees it will get voted up and rise to the top of the answer list. If you don't feel you can answer or edit the code then leave a comment explaining why the code is bad practice.

However, I agree with you in that I don't think you should be editing the code in questions. The "bad code" could well be the cause of the problem. In these cases leave a comment or, if it is the cause of the problem, an answer with the corrected code.

You can also down-vote.

share|improve this answer
    
I wrote non-tag solution. So I'd like to see a way of marking questions as well as answers containing bad practice. As I see it, there is a new generation of askers where editing the code just a little is impossible because you'd need to completely rewrite that code and that doesn't make sense. So in order to have a way for other beginners to see what code they can trust and reuse such an enhancement would be a great improvement in my opinion. –  markus Sep 24 '11 at 12:24
1  
I do NOT thing editing the errors out makes sense in many cases because such an edit would render the question senseless. Bad code has to stay to show the point of the question but it should be possible to mark it as bad example. –  markus Sep 24 '11 at 12:25
    
@markus - yes you did. My mistake. That doesn't change my answer though, so I'll just edit that bit out. –  ChrisF Sep 24 '11 at 12:25
1  
@markus - re your second comment. I didn't say you should edit bad code in questions - in fact I said the opposite. The way to mark these as bad code is to comment or provide good code in your answer. –  ChrisF Sep 24 '11 at 12:27
    
I see that you're not active in any of the tags I mentioned so I can imagine you do not understand the scope of the problem!! –  markus Sep 24 '11 at 12:27
    
@markus: On an Q&A site, I would expect questions to include bad or wrong code and answers to include better or corrected code. Who reads only questions and copies code from a post effectively saying "This is how it didn't work for me"? Isn't it obvious that the code in the question will reproduce the same problem that was asked about? –  scenia Mar 11 at 9:16

You must log in to answer this question.

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