9
\$\begingroup\$

I'm having difficulties staying interested in Code Review. I don't feel like I'm participating to anything 'grander' than just stating the same design principles over and over again, hence I started participating less and less. I can't speak for others, but I feel this is a real issue if Code Review ever wants to get out of beta.

Almost over a year ago here, and as far as I'm concerned it's not, which raised the question "How can we make Code Review more useful for a broader audience?".

One thing which should be accepted is that Code Review doesn't fit the default Q&A format. Just consider the 'duplicate' and 'too localized' close reasons for starters. This makes this site "a bit of an odd duck and a trial balloon." as Jeff Atwood called it. This doesn't have to be a bad thing at all - I'm even a proponent of experimenting with the SE engine to use it for other purposes -, but it does mean the system isn't 100% in sync with the purpose of this site. Where the system fails, we have all the more need for proper conventions which are enforced by the community, which brings me to my actual suggestion ...

What if we create elaborate tagging conventions which group code samples (questions) under recurring design flaws/design patterns? This site would effectively become a possible resource for outside users to look for examples on a certain topic. We could even encourage users to review code themselves by applying 'design flaw' tags to their questions. The wikis of the tags prevents us from having to restate the intention behind a design principle over and over again, and the tags become a resource of design principles and common pitfalls.

Somehow the idea of working on something reusable would make it a lot more worthwhile for me, but it could just be my OCD for the DRY principle. What about you?

\$\endgroup\$
  • 2
    \$\begingroup\$ I'm all for keeping the site DRY \$\endgroup\$ – Ben Brocka Jan 20 '12 at 0:11
  • \$\begingroup\$ To follow/participate in a less structured discussion of this idea, join chat. \$\endgroup\$ – Steven Jeuris Jan 20 '12 at 21:51
  • \$\begingroup\$ Stackoverflow has a tag called c++-faq. It is used to address common design flaws as well as other things. Perhaps Code Review could do something similar. \$\endgroup\$ – jliv902 Apr 23 '14 at 14:07
2
\$\begingroup\$

Tagging questions based on the answers they receive doesn't sound quite right to me for two reansons:

  • These tags would be added after the question is asked, and feel more like what the community thinks of the code than some kind of intrinsic property of it. For example, there's a clear lack of consensus on whether this is something that should be refactored or not -- you could tag it as overly-complex-code, but I think that's just asking for edit wars.
  • While getting some real-life examples of a design error may be useful, I have trouble seeing the questions as providing valuable examples (except perhaps to illustrate pitfalls). For example, while one could take a look at this to learn about memory leaks in Objective-C, it doesn't seem like the best resource.

Currently, Code Review generally consists of people posting code (which solves some problem) they think is mediocre/could do with improvement, and people suggest improvements on it. The problem is that this is always very localised: the asker benefits, but most questions just aren't general enough to be of use to anyone else.

In addition to this, I think it would be nice if people would post code that is aimed to solve a single problem, and solve it perfectly -- it may be harder to critique such code, but this would both make the issues less repetitive, and produce well-documented and efficient solutions to practical problems.

I took a look at the top ten users (based on reputation), and found that they had asked 14 questions in total (with an uneven distribution). Perhaps it would help if there was less of a split between "askers" and "answerers"? (I don't have actual number on average reputation of askers; may be worth it to take a look.)

\$\endgroup\$
  • \$\begingroup\$ First of "there's a clear lack of consensus", would be a clear indication not to apply any tags. Second: overly-complex-code is not a principle, perhaps over-engineering could be, but even about that I would be skeptical, and a 3 line piece of code definitely wouldn't fall under that category. If anything useful, I would tag it style-war, as everybody agrees .. not to agree. \$\endgroup\$ – Steven Jeuris Jan 21 '12 at 13:50
  • \$\begingroup\$ As to 'valuable examples', that's where the community effort comes in. Suppose we have a convention where a tag is suggested through a comment. Once x amount of people agree it is a nice example, the tag can be added. \$\endgroup\$ – Steven Jeuris Jan 21 '12 at 13:54
  • \$\begingroup\$ Funny thing, seems like I am one of those top 10 users (7th) and asked almost half of those questions (6). Seeing this makes me realize the problem is all the bigger. I wonder whether the other top 10 users feel the same. \$\endgroup\$ – Steven Jeuris Jan 21 '12 at 13:59
  • \$\begingroup\$ P.s.: I study in Utrecht as well! ;p \$\endgroup\$ – Steven Jeuris Jan 21 '12 at 14:01
  • \$\begingroup\$ @StevenJeuris: Perhaps overly-clever-code would have been better. :P Basically, as far as I see, there are two issues to be handled: figuring out what problems code shows, and figuring out how others can benefit from seeing them. I think the first is likely to be so subjective that it will do more harm than good (although I am entirely in support of trying it for a while). The second is more annoying: it's not that the community couldn't spot a good example, but the nature of Code Review doesn't seem to lead to such examples -- and that's a problem I think regulars should focus on. \$\endgroup\$ – Anton Golov Jan 21 '12 at 23:25
  • \$\begingroup\$ @StevenJeuris: Awesome! I'm just a lowly first-year, though. \$\endgroup\$ – Anton Golov Jan 21 '12 at 23:30
  • \$\begingroup\$ "figuring out what problems code shows" is remarkably objective. There are plenty of books discussing proper code: Refactoring, The Pragmatic Programmer, Code Complete, Clean Code, ... I can't speak for all tags, but looking through answers of c# shows there often is a consensus about what could be improved. Research exists which tries to find measurements how good code is. Code analysis tools etc ... \$\endgroup\$ – Steven Jeuris Jan 21 '12 at 23:44
2
\$\begingroup\$

What about general community wiki questions and answers? An example question would be How should I name my variables in Java? An answer could contain a link to the Code Conventions for the Java Programming Language document (and some relevant quotation) with useful examples.

Then it would be enough to answer a question with short variable names like this:

I'd rename $w to $width. Details here: [link to the above mentioned community wiki question].

I think it could work because I often do something similar: I open my former answers and copy full sentences to new answers.

According to the current FAQ these questions seems offtopic on CodeReview now but I think the FAQ could be changed. Or should these questions be on Programmers.SE?

\$\endgroup\$
  • \$\begingroup\$ They definitely belong on Programmers.SE, and I don't see an issue with linking there. The idea I had in mind was a bit more advanced than your suggestion however. I already link to relevant posts in my answer, but the idea would be to do this in a structured way using tags. When I have time I will write up the entire concept. If you have a suggestion yourself I'd gladly hear it! \$\endgroup\$ – Steven Jeuris Jan 25 '12 at 12:01
  • \$\begingroup\$ @StevenJeuris No! "Name that thing" questions are off topic on Programmers.SE. We welcome terminology questions, and "How should I name my variables" might be ok, if it's a small part of an otherwise on topic question, but if it's just that, we will kill it with fire... \$\endgroup\$ – yannis Jan 25 '12 at 12:15
  • \$\begingroup\$ @YannisRizos: I didn't have 'name that thing' questions in mind, rather, "How to apply the Law of Demeter in OOP?" which explains the process a user which is referred to LoD should go through. You could even link back to a resource tag on Code Review to see examples (if this suggestion were ever to get through). \$\endgroup\$ – Steven Jeuris Jan 25 '12 at 12:26
  • \$\begingroup\$ @StevenJeuris Oh, ok for a moment you had me worried there :) \$\endgroup\$ – yannis Jan 25 '12 at 12:43
  • \$\begingroup\$ I strongly disagree: the question How should I name my variables in Java? does not relate to any specific code, which this site is about. A general question like How to apply the Law of Demeter? would be more suited on Programmers, as far as I understand the sites. \$\endgroup\$ – Anton Golov Jan 27 '12 at 17:55
  • \$\begingroup\$ @AntonGolov: It also does not fit to Programmers.SE (as Yannis Rizos mentioned), that's why I said that CodeReview FAQ should be changed first. So, currently it doesn't fit here but these pages could help people to write better code and could help reviewers too (to link them in actual reviews). \$\endgroup\$ – palacsint Jan 27 '12 at 19:18
  • \$\begingroup\$ @palacsint - Do I correctly understand that you mean questions like [programmers.stackexchange.com/q/132193/36479][this one]? It seems to be considered on-topic on Programmers.SE. As for the question in the original example -- how would having this question around to link to be better than linking directly to the relevant part of the Code Conventions? Due to the simpleness of these questions, I think they would sooner lead to duplicates and tens of answers per question, as opposed to increased activity amongst regulars. \$\endgroup\$ – Anton Golov Jan 28 '12 at 11:50

You must log in to answer this question.

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