# Is there a better format for posting questions for code review

At times I have seen quite a bit of code posted for review. This might be because there are a number of classes that interact so the person is giving as much information as possible, or they might be posting too much. After the code, or before or even within, there might be updates, or edits.

Does the current avaialable structure for code reviews make the process as easy as possible so people can easily read the code and make comments? Could there be a better way? One thought I had was to have multiple tabs for the various classes, modules etc and a tab for the problem description. So you would seperate the code from the question?

Is there any scope for making site modifications from what seems like the standard exchange template? Or are people happy that the way in which code is presented for review provides an easy mechanism for encouraging people to do more views?

EDIT: Perhaps rather than reviewing the format of posting code reviews an example could be placed up on the site FAQ of what is a good question layout and how to actually as a good question, as well as how to follow up with edit's and changes.

EDIT 11-Nov: Here's an example Mutable JTree style question. The SO has 4 distinct classes and if all put in might actually a fair bit of code. I assume all 4 classes are required to help with the code review. Would not it be easier to read and review this if you could flick through the code in a tab based method much like Visual studio, Eclipse and many other editors and applications that uses tab based format.

### Am i flogging a dead horse here because Code review is still in Beta?

-
For simple questions, the current format works well. It fails for iterative reviews and questions with large amounts of code. I believe this is the symptom of a larger challenge: How do we shape our community to comply with the StackExchange ideology where every question has a correct, canonical set of answers? AFAIK our failure to find a solution for that is the main reason we haven't graduated out of beta stage so far. – codesparkle Nov 3 '12 at 22:57
I guess it the large amounts of code and iterative reviews where I see the most confusion in layout and readability of questions. could the lack of finding the answers be a sympton of a lack of ease of understaning in questions? – dreza Nov 4 '12 at 0:24
I think an important question here is whether or not those questions are simply too big? Maybe it should be that they should be split up into a couple of reviews, or be simplified and the advice given applied across the board. – Latty Nov 12 '12 at 0:16

I think there is potential for improving the format and tools surrounding code review, editing, and commenting.

Correct me if I'm wrong, but this is the first Stack Exchange site to support significant amounts of code. Of course, I'm only really familiar with Stack Overflow, but I have rarely seen code there over a dozen lines, and most questions/answers are 100% English (that I've seen).

That is to say, it makes sense that the existing format and tools might not fit the new requirements.

I find that editing code in this editor is substantially more difficult than editing code on Github. I've also found Github's code comment abilities to be an extremely useful tool in code reviews.

For example, take this question and its accepted answer. Notice how the comments are not integrated with the code? How long does it take you to find the line that the first note is referring to, Please do not abbreviate words, choose short words or acronyms ( Len -> Length )? The answer has to duplicate the code in order to refer to specific lines.

Now checkout this version I mocked up in Github.

In addition, I think Github's code editor (which I believe is Ace?) is much nicer than editing code in the Stack Exchange editor. In my very humble opinion ;)

I understand there are reasons not to rely on external tools such as Github, but I think a decent code review site would be well served by some of the nice features that Github has implemented.

-
That GitHub example seems like a nice flow – dreza Dec 16 '13 at 21:50
But how would you combine that with the Stack Exchange format of Q&A? Maybe using line numbers? (Show line numbers on the code in question and the same line numbers in quotes in answers.) – svick Dec 18 '13 at 1:12
svick, the Q&A format would remain, but answers would be provided a "clone" (to use Git parlance) of the code being reviewed, allowing for better edits and comments. This could clarify which version an answer is reviewing too, as increments to the original code are made. I could mock this up if needed. Also, if code were treated as a sort of special attachment, code could easily be separated from the question text. That could create the potential for other cool tools: imagine doing git clone git://code.stackexchange.com/questions/626/ – Alex Buchanan Dec 18 '13 at 1:38