# “Enough reviewable code”

Passing Row Index of TableViewCell (custom) to another view controller

The following claim is made in the asker's question:

Pseudo Code: (pasted only necessary code)

(pasted only necessary code)

Neverminding the fact that I'm unclear on "necessary" (necessary for what?), the fact of the matter is, this simply is an untrue statement.

He provides this method:

- (IBAction)btnSubmitPressed:(id)sender {

NextViewController *sVC = [[NextViewController alloc]     initWithRecIndex:@"NextViewController" bundle:nil Index:self.iRecordIndex];

// Pushing NextViewController to NavigationViewController.
}


And part of his question is asking about how pushing the button which calls this method actually presents the view controller. He's only included the code for instantiating the view controller. He doesn't include any of the code which should be setting properties on the view controller, nor does he include the code for actually presenting the view controller.

Posting entire classes and entire projects might be too much to ask and mean too much code. I'm fine with leaving out extraneous classes or extraneous methods from classes, but I think leaving executable lines of code (even comments, since we review comments and lack of comments as well) from posted methods is absolutely unacceptable.

I'm fine copy & pasting code over to my IDE and writing the rest of the context to make the posted code work... but if I have to add executable lines of code to the methods you expect to be reviewed, at that point, the question is off-topic for me.

It's not that the project doesn't work without providing other classes. It's not that the class doesn't work without providing other methods. It's that the method expecting to be reviewed doesn't work without providing more lines of code.

The primary point here is that "only necessary code"? Sure, but not ALL of the necessary code is posted. Again, the user wants to review the process of presenting a view controller, but hasn't provided the actual code that does this in his question!

In chat, a few users pointed out to me that there are already 2 answers to this question. How is that relevant? The only reason there are two answers to this question is because any iOS programmer knows how to present a view controller and can imagine what the missing lines look like, and they review the code based on that assumption.

But that doesn't change the fact that the code is missing!

And ultimately, the "enough reviewable code" just doesn't work for me as a blanket defense for keeping a question open. I can write an entire paragraph about how a class, variable, or method is named. By definition, that makes basically every single question on-topic. Why does a posted answer automatically make a question on-topic?

This isn't about whether or not the question is answerable. I get the gist of what the author is doing. I could answer this question, but if I did so, I'd be doing it in mostly the same way I'd answer a StackOverflow question, because a ton of the relevant code is missing. This question looks like a typical "I got this far but don't know what to do to finish doing X task." question on StackOverflow. And if I did come across this question on StackOverflow, I certainly wouldn't recommend migrating it to CodeReview.

The fact of the matter is, we actually regularly get users posting broken code here. We close this questions and typically direct the user to repost at StackOverflow. But the fact of the matter is, if we ignore the fact that the code is broken, there's plenty of reviewable code in these questions.

For example: Returning factorials greater than 12 [on hold]

The question is appropriately closed as off-topic, as it is broken code. But it actually does contain plenty of reviewable code if we were to pretend it's not broken.

We can talk about poor variable names, the fact that the method name isn't appropriately camelCased, and very bad indentation. If this code worked, it wouldn't be closed as off-topic and would have answers. But it doesn't work.

"Enough reviewable code" simply isn't, on its own, measure enough of whether or not the question should stay open.

• Wouldn't this be off-topic in StackOverflow as well since the primary question asked is "how do I improve this code"? The OP implies that their code works, they are likely just unsure how much of their code to share. Seems like the question could be made on topic by simply providing the missing code. – CrimsonChris Jul 26 '14 at 1:07
• I made no comment on whether or not it'd be on-topic on SO as it's irrelevant. I only commented that I wouldn't have recommended it be migrated from SO to CR as it'd be off-topic here. – nhgrif Jul 26 '14 at 2:08
• And actually, I do agree that this question could easily be made on-topic by changing the amount of code in the question. That's why the question is on hold and not deleted. The question is on hold given the asker opportunity to improve the question, and if the asker fails to do so, the question will be deleted. – nhgrif Jul 26 '14 at 2:11
• Though this doesn't even necessarily have to mean posting more code. If he narrowed the posted code down to just FirstViewController.h/FirstViewController.m, it'd be on-topic from my point of view. – nhgrif Jul 26 '14 at 2:13
• Thanks for the clarification. – CrimsonChris Jul 26 '14 at 2:19