24

Stack Overflow is more than anything else a place to ask programming questions, but we also have stuff like tips and tricks, code golf (to the chagrin of some), programming as a profession style questions, programming jokes, books, blogs, etc, etc...

I've also seen, and myself placed, problematic code and/or code with unconventional ideas to be viewed by others on Stack Overflow and get help and or opinions about the snippets... in a way a code review of sorts.

So I was wondering how do the rest of you feel about Stack Overflow as a place for simple code reviews (barring placing illegal code). Is this an activity that is in line with the purpose of Stack Overflow or not?

Note: My opinion is Stack Overflow is great for small code reviews of personal projects and such.

0

9 Answers 9

24

It's a great idea, unless you're employed. Don't post company-owned code without express permission! And make sure any sensitive information is removed or replaced. You could get into real trouble if your boss finds company source code floating about on the web.

2
16

As usual, "it depends" -

No

  • If you just want someone to bench-check your widget class before you check it into VSS and clock out for the day, ask a co-worker.
  • If you want someone to double-check your homework before you turn it in, ask a fellow student.

Yes

  • If you're having a problem with your code, yes - post it, describe the problem, and we'll all learn something.
  • If you've discovered the solution to a problem, post the question and your code as the answer, and we'll all learn something.

So in general, I'd have to say "No, SO is not a free code-reviewing service".

0
11

No. I've seen people do it, but it makes me uncomfortable.

As I understand it, SO was envisioned as a repository of software knowledge, where all the good questions get asked, and all the good answers get saved, and anyone with the same questions can find those good answers later.

These kind of "one-off" questions are too specific to contribute much to the knowledge base. Who else is going to have that exact problem later? Questions should be general enough to be useful to someone else, not just you.

2
  • But with proper tagging these "Patterns" and snippets would probably help others. However 10% of me feels the same as you that's why I'm asking :) Commented Mar 6, 2009 at 4:33
  • It might, but then you get people asking about errors in code that are so elementary that anyone with the same question probably doesn't know the domain well enough yet to know how to search for the answer. :o/
    – Amanda S
    Commented Mar 6, 2009 at 4:56
7

I would say absolutely but within reason. I can't really see anyone willing to spend large amounts of their time code reviewing entire projects.

7

There is also a Stack Exchange site specifically dedicated to sharing working code for peer review: Code Review

6

Yes, why not. "Is my code good" is a programming question. And I am sure you would receive lots of answers.

1
  • 2
    "Is my code good?" is a subjective question, and "lots of answers" suggests that there is no answer we can agree on. That makes it less suitable for SO. Commented Nov 4, 2009 at 17:52
3

I think it depends on a case-by-base basis. If you just put code up and ask if it's OK, I think there is a fine line you can cross into the realm of "not asking a programming question."

On the other hand, if you have code that you are "unsure of" or think there is possibly something wrong with, then post it and see if others can spot the problems.

3

It depends which portion of the voting population is online at the time. :P

4
  • Yeah that's my feeling too. That's why I'm asking to accumulate a more or less consensus on the topic Commented Mar 6, 2009 at 3:44
  • There are about 45,000 users on SO and you expect some sort of consensus. What a happy little world we live in :-)
    – user14860
    Commented Mar 6, 2009 at 3:49
  • You have no idea what I'm expecting ;) Commented Mar 6, 2009 at 4:03
  • Bravo! Nicely put!
    – Rook
    Commented Mar 6, 2009 at 4:16
2

I don't mind - I'll vote yes. Most people here are pretty responsible with what they ask/post.

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