I flagged this SO question for migration to Code Review. It's 100% C++ and, despite the fact that the OP initially left out a constructor definition that rendered the program buggy, that definition was later added in by me and program bugs were never the point of the question. The question was asking for advice on whether he could write his getter any better than he had.

I'm told the migration was rejected by Code Review mods with a rationale paraphrased by an SO mod as:

As written it doesn't appear to be about real code SomeClass, it appears to be pseudo code.

Well, it's certainly not pseudocode. Can you elaborate on the reasons for rejecting migration of this question? I'm not complaining: I'd just like to ensure that I do not waste any more of your time with migration requests that are destined to be refused for whatever extant reason of which I'm not yet aware.

• The link to the CR post that was rejected is here. The closure reason was Questions must involve real code that you own or maintain. Pseudocode, hypothetical code, or stub code should be replaced by a concrete example. Questions seeking an explanation of someone else's code are also off-topic. – Taryn Nov 19 '14 at 17:24
• @bluefeet: I don't see that it's "Pseudocode, hypothetical code, or stub code". It's real code. If the problem is that that exact sequence of bytes does not physically exist in a version control repository at the current point in time, I can resolve that immediately if it would help. ;) – Lightness Races with Monica Nov 19 '14 at 17:33
• I just wanted to thank you for asking. – RubberDuck Nov 21 '14 at 1:31

I've rejected the migration because the presented code appeared to be example code.

Indications of this include:

• class SomeClass
• "I simplified some stuff so that I could make a short code example"

If you see something like that, then it's very likely that the question is off-topic. It seems to be common for others to think that a question always belongs if it asks for a code revew. That is incorrect because we only review real code, which isn't the case here. If the OP had eventually edited real code in, then it would be on-topic.

This does still apply, even though it's not exactly pseudocode. The concept of "real code" on this site corresponds to project code or something similar to that.

• There is no reason, as far as I can tell, to treat this is as "not real code" just because the type names have been obfuscated. I can take the OP's code and put it into my real-world codebase right now, if you like, without changing any of it. Does that make it "real code"? If I do so, will you reconsider the migration? What are the criteria for being "real code"? Either way doesn't change the question at all, which is "can I write this fully valid and C++-compliant getter method in a better way"? I was under the impression that Code Review exists to explore this sort of concern. :) – Lightness Races with Monica Nov 19 '14 at 17:31
• @LightnessRacesinOrbit: It would've helped if there were some context to see how this was used originally. And we have closed similar questions with obfuscated names. That's when we usually ask the OP to replace them with the real names, thereby revealing the context. We shouldn't need to guess what this is. – Jamal Nov 19 '14 at 17:35
• I see. Well, I don't see how "context" of the code's purpose in life is particularly relevant for the question of whether or not this function has a code smell: in the context of the programming language in use, whether or not that function is smelly has nothing whatsoever to do with the context in which it was written. Anyway, you have answered my question and now I know! So thank you for engaging. – Lightness Races with Monica Nov 19 '14 at 17:37
• @LightnessRacesinOrbit: You're welcome, and I appreciate you trying to learn more about it. The more SO users are familiar with our scope, the better. – Jamal Nov 19 '14 at 17:39
• @LightnessRacesinOrbit By providing a question with context, we can provide an answer with context. You have a problem where you can't decide between method A or method B or method C for implementing a particular feature. By providing context, one enables us to come with an answer that shows method D - use of some sort of design pattern, or a library function, or extracting some of the code to separate functions... This 'method D' would be something you hadn't thought of before, and in my experience, it's the best kind of answer to receive. – Pimgd Nov 19 '14 at 17:57
• @Pimgd: I'm one of those people who would like to hear about Method D in comments, and get an answer to the actual question that I asked you (i.e. "which of A, B and C is better?") as an answer. – Lightness Races with Monica Nov 19 '14 at 18:02
• @LightnessRacesinOrbit See Why is hypothetical example code off-topic for Code Review? – 200_success Nov 19 '14 at 18:12
• @200_success: That's the one, ta – Lightness Races with Monica Nov 19 '14 at 18:30