10
\$\begingroup\$

I had sought out review for a question about some proprietary code that I am working on. The code in question retrieves information from a list of one-to-many mappings and seeks to build a relationship between devices based on that. The code on CR was posted after obfuscation and was understood.

https://codereview.stackexchange.com/questions/186516/find-out-relation-between-devices-when-given-a-one-to-many-list-of-mappings-in-l?noredirect=1#comment355957_186516

The Thing is actually the type of the device used. For example destinationTurbineMapping has been redacted to destinationThingMapping. Further, it was found that the type of device did not have relevance to the code itself because it was all about the same device. And therefore, even in my source code, I have modified it to destinationMapping.

One answer mentioned that I did not need to include the type of device name(Thing) because it was unnecessary. I found this to be very useful to make the variable names meaningful so as to help future readers. So I made the edit to the question. I even edited the original source code on my workstation to reflect the same.

No other changes.

However, my edit was rolled back by a user citing that an edit would invalidate the answer, for which I enquired whether the answer could be edited ever so slightly to reflect this change my mentioning that the question no longer has it.

That's it. The next thing I know, the question gets put on hold for being off-topic citing unoriginal code. (one person involved was the same user who asked me not to edit)

I request that the question be re-opened. If not, I request for clarification on why the question is off-topic and what I can do to make it not so. I'd be happy to answer any doubts.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ I think everything looks good now. Since the original question had 3 reopen votes, and both questions had a similar answer, I reopened the original, only to mark it as a duplicate of the newer/cleaner one. Sorry for the inconveniences, I hope you get a better CR experience next time! \$\endgroup\$ Feb 2, 2018 at 15:24
  • \$\begingroup\$ The confusion that arose led to a Catch-22 situation. Thank you @Mat'sMug for helping with clearing and cleaning up. \$\endgroup\$ Feb 6, 2018 at 3:55

3 Answers 3

6
\$\begingroup\$

First I'd like to apologies that you've been put in this horrible situation. Whilst your code was off-topic to start off with, you've tried many ways to get the question to be on-topic. Mostly to be shot down because you supposedly answer invalidated.

This is unfair on you, as someone else broke our rules. But you're the one to be punished.

This is not the first time this has happened, and last time we as a community said that you should be able to edit your question. Unfortunately some people don't follow, or remember, this meta discussion. And favour the don't answer invalidate policy.

Either way, the answer has now been removed, and so you can edit the question in any way you want. Which you should have been allowed to do anyway.


Your question was closed as it's Pseudo/example/stub code, rather than you not owning it. This was addressed in the comments:

  • Please include code for ThingCustomStruct1 and dataTag. - Jesse C. Slicer link

  • Note that sourceDestinationThingMappings[sourceThingName]).Add(destinationThingName); breaks the build: there's either a bracket missing, or one too many. - BCdotWEB link

I'm not a C# professional, and so I don't know if these are the only problems, or if the above have been fixed.

And so I'd recommend that you'd update your question with the entire of your code. If you post your code so that we can copy the code, run it in our IDE, and for it to output the information that you want, then there shouldn't be a problem.

The only other things would be to remove this from the variable names, as that seems to make a lot of people think it's example code. Which you have done.

\$\endgroup\$
8
  • 1
    \$\begingroup\$ "This is unfair on you, as someone else broke our rules.". Although I agree about answers to off-topic questions are invalid, the OP is a member on CR for more than 3 years hence it had been time enough to read the help/ask which leads to If your question is not real code \$\endgroup\$
    – Heslacher
    Feb 2, 2018 at 11:07
  • 1
    \$\begingroup\$ @Heslacher Yes, and we close peoples questions when they do that. We don't close them and not allow them to fix it. \$\endgroup\$
    – Peilonrayz Mod
    Feb 2, 2018 at 11:09
  • 2
    \$\begingroup\$ @Heslacher member for 3 years, yes. With a whopping 3 questions asked, including 2 in the past 24 hours. I've been a member of SFF.SE for years, never posted anything. Membership age doesn't mean much. \$\endgroup\$ Feb 2, 2018 at 15:06
  • 2
    \$\begingroup\$ Off-topic questions getting answered anyway is quite often a problem. \$\endgroup\$
    – Mast Mod
    Feb 5, 2018 at 8:15
  • \$\begingroup\$ @Mast Do you mean in more ways than just to re-open? Also is it a problem that 2% of questions on Code Review are off-topic and have been answered. 1000 / 51000 (open&closed) or 50000 (open) \$\endgroup\$
    – Peilonrayz Mod
    Feb 5, 2018 at 9:10
  • \$\begingroup\$ Primarily because it screws with re-opening and invalidation, like here. But also because it lowers quality standards and makes us look like SO. At SO, you don't need to write an on-topic question to get answers. You just need your question to be noticed, easy and for some rep-wanting user to pass along. Along that line lies the problem of users upvoting off-topic questions, making it look like it's a good idea to ask them anyway. \$\endgroup\$
    – Mast Mod
    Feb 5, 2018 at 9:36
  • \$\begingroup\$ @Mast I agree, :) I've looked further into the off-topic questions, and a shocking amount of off-topic questions have upvoted answers. I wrote a query and it shows that 1019 / 1094 off-topic questions have an upvoted answer. Where there's only 26 that have a downvoted answer! \$\endgroup\$
    – Peilonrayz Mod
    Feb 5, 2018 at 10:39
  • \$\begingroup\$ Thank you @Peilonrayz for the support and being understanding of the paradoxical situation. The code in question was hard to understand, because of which it got put on hold, but cleaning it up was not allowed as per certain users. Thank you Mat's Mug for suggesting a cleaner route. \$\endgroup\$ Feb 6, 2018 at 3:58
3
\$\begingroup\$

It happens regularly that the code in the post is broken (or otherwise not ready for review), but the problem is too complex to explain or demonstrate in the limited space afforded by a comment, and needs to be posted as an answer. Here's an example from earlier today, here's another from a week ago, here's a third with a detailed explanation of how to discover the bug, and here are some more: 1 2 3.

Current procedure

What we (Code Review regulars) would like to happen in these cases is:

  1. We vote to put the question with the broken (or otherwise unreviewable) code on hold.

  2. The OP fixes the code.

  3. The OP posts a new question with the improved code.

The reason we would prefer this is that it leaves a record of what the problem was — sometimes the technique needed to discover a bug is interesting, but even if it's just a reminder not to post code without testing it, that's still valuable.

Is the procedure too onerous on the OP? It doesn't seem difficult to me to copy the text of the question that was closed, and paste it into a new question. But I guess it might not seem so easy for a beginner.

Alternative procedure

But if we are agreed that is too hard, then what's the alternative? Perhaps:

  1. We vote to put the question on hold.

  2. The OP fixes the code.

  3. The OP updates the question.

  4. We vote to reopen the question.

  5. The reviewer who explained the original problem deletes the answer in which they explained it (since this answer is now unrelated to the question). Or someone else flags it for deletion by a moderator if the reviewer does not delete their answer in a timely fashion.

This is more complex than the first procedure, it takes substantially longer (because of the delay at step 4), it erases the record of original problem and its discovery, and denies credit to the person who discovered and described the problem. I don't think it's an improvement at all.

\$\endgroup\$
3
  • \$\begingroup\$ IIRC the first two 'answers' should be community wiki's, and that link says we should be using the 'alternative procedure'. Answer three and the answer to the above questions are reviews - rather than comments saying the question is off-topic. \$\endgroup\$
    – Peilonrayz Mod
    Feb 2, 2018 at 14:50
  • 1
    \$\begingroup\$ Wouldn't the alternative route actually lead to a cleaner CR, because we'd have lesser questions. Also , the record is still maintained via the Edit History. \$\endgroup\$ Feb 6, 2018 at 4:00
  • \$\begingroup\$ Also, how would one go about it if it was a minor change in the question that would invalidate one of say, 20 suggested improvements? Can the answerer be notified to make this update? Of course, it may also be argued that it becomes an extra burden on the answerer. \$\endgroup\$ Feb 6, 2018 at 4:01
2
\$\begingroup\$

The code in question, although you state it is your code and you maintain it and you have added enough context, is too much obfuscated.

In its current form it just looks too much like example code because of all the "things". If you would have used different names like device instead of thing the code would speak for itself and one wouldn't need to read all the text in question. In addition the context of the question would be more clear.

But you had choosen to go the other way stating

I have written a function in my backend that takes a list of on-to-many mappings of communication (already defined by Legacy Code) from one Thing(proprietary Device name redacted) to another.

and plastered your code with things.

In its current form I won't vote to reopen the question. Unfortunately you can't make the question on-topic without changing the code. Changing the code like you did had invalidated the given answer in many points.

  • names of variables (removing obfuscation)
  • var vs concrete type
  • PascalCase vs camelCase

hence rolling back the edit had been the correct way.

As long as the answerer doesn't delete his/her answer you can't make the question on-topic. You could just accept it (the answer and the fact that it can't be made on-topic anymore) and ask a follow-up question.

If you tend to ask a follow-up question you could/should integrate the mentioned points of the answer and fix your code in a way that it isn't obfuscated that much.

\$\endgroup\$
9
  • \$\begingroup\$ This puts us in a weird situation. I can't change the code as I did because that would invalidate the answer. I can't ask another question with the same code segment because I haven't been able to implement the proposed answer. What I've done is edit to add an explanation and remove the obfuscation, while keeping everything else. This only invalidates one point in the answer, and I think that this marks a balance between readability of the question itself, and all a display of all the areas where it went wrong. The var vs concrete type issue is still left as is. \$\endgroup\$ Feb 2, 2018 at 8:18
  • \$\begingroup\$ Furthermore, the answer, after mentioning obfuscation, seeks to address other problems using the clearer names. Therefore, making that change will not affect those bits at all. I hope that this makes a case for a re-open. :) Let me know if anything can be done further. \$\endgroup\$ Feb 2, 2018 at 8:19
  • 1
    \$\begingroup\$ No, thats not true. Your recent edit invalidates still the 3 mentioned point in my answer here. Hence, as you can't ask a follow-up because you didn't implement the changes I would suggest todelete your question and ask a new one. \$\endgroup\$
    – Heslacher
    Feb 2, 2018 at 8:21
  • \$\begingroup\$ The var vs concrete type exists. The obfuscation is gone. The PascalCase vs CamelCase is gone along with that. \$\endgroup\$ Feb 2, 2018 at 8:22
  • \$\begingroup\$ I can't delete and ask a new one because CR detects it as a duplicate. Tried that yesterday. :( How best to resolve this? \$\endgroup\$ Feb 2, 2018 at 8:23
  • \$\begingroup\$ I guess (really only a guess) that detection of a duplicate is only regarding the title of the question. \$\endgroup\$
    – Heslacher
    Feb 2, 2018 at 8:24
  • 5
    \$\begingroup\$ @ValarMorghulis The answer has been upvoted and therefore the question can't be deleted by the OP. If you can get the answerer to accept you changing your question and the answerer to change the answer, then that's okay - but it's a longshot. What prevents you from implementing the proposed answer, with the better variable names, and ask a follow-up question? \$\endgroup\$ Feb 2, 2018 at 9:20
  • 3
    \$\begingroup\$ "Changing the code like you did had invalidated the given answer in many points." I thought we'd come to the conclusion Answers to off-topic questions are already invalid, it's unfair on the OP that they can't improve their standing in the community because someone answered an off-topic question. Something the answerer shouldn't do. \$\endgroup\$
    – Peilonrayz Mod
    Feb 2, 2018 at 9:43
  • \$\begingroup\$ @SimonForsberg The situation has been resolved to an extent now, thanks to Mat's Mug and Peilonrayz . The better variable names have been implemented and the question has been asked again, as per your suggestion. \$\endgroup\$ Feb 6, 2018 at 4:03

You must log in to answer this question.

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