You should be more careful who you take advice from. On your Stack Overflow post a user with 156 rep, on Code Review, told you to post here. Then a moderator with 25k rep told you your post would not be a good fit for the site. Typically a core member of a site is going to know more about the site than someone much less involved. You completely ignored the moderator's advice leaving the problem in the question.
@Julian while it is acceptable to ask about inherited code as the maintainer "We expect you, as the author, to understand why the code is written the way that it is." thus question 1 would not be on-topic there.
– Sᴀᴍ Onᴇᴌᴀ
2022-07-20 21:06:45Z, License: CC BY-SA 4.0
Lets look at the section of your question Sam was referring to.
- Gain insight on why the original author wrote the code in this way in the first place, and
Now lets look at the comments you got on Code Review:
If you didn't write the code, and don't understand why it was written the way it was, then we cannot review the code, as per the site rules in the help center. Unfortunately, Stack Overflow users often make improper recommendations to post to Code Review because they are unfamiliar with our rules.
– 200_success
2022-07-28 06:38:51Z, License: CC BY-SA 4.0
If you [...] don't understand why it was written the way it was, then we cannot review the code
One of the requirements is: Am I an author or maintainer of the code? "For licensing, moral, and procedural reasons, we cannot review code written by other programmers. We expect you, as the author, to understand why the code is written the way that it is."
– 200_success
2022-07-28 21:18:44Z, License: CC BY-SA 4.0
We expect you, as the author, to understand why the code is written the way that it is.
If you don't understand the code, or you want people to confirm that your co-worker wrote it wrong, then that goes against the spirit of Code Review, as well as that rule. We've accepted questions where two co-workers are debating between two valid ways of writing the code. We've rejected questions where a boss wants us to criticize code written by their employee. This question is closer to the latter than the former.
– 200_success
2022-07-28 21:28:22Z, License: CC BY-SA 4.0
If you don't understand the code
200_success's comments have said the same as Sam's. I'm not sure how we could be more clear about the problem in your question. I also can't comprehend why you've come to the conclusion you think the problem could be confirmation bias.
Lets look at your one of your responses. Because your argument stays the same.
@200_success I don't understand why this is not an acceptable question. I can answer "yes" to all of the questions in the link you provided. Specifically, "To the best of my knowledge, does the code work as intended?": YES, it does work as intended! I am not asking about code that isn't working. It is working adequately enough. My posting here is to understand why someone might write code this way (was there an underlying reason that I don't understand?) and whether there is a better way to achieve the intended result. If this question doesn't fit the site's requirements, then what does???
– Andrew
2022-07-28 21:13:17Z, License: CC BY-SA 4.0
Lets look at the relevant section of the help center:
Am I an author or maintainer of the code?
For licensing, moral, and procedural reasons, we cannot review code written by other programmers. We expect you, as the author, to understand why the code is written the way that it is.
We expect you, as the author, to understand why the code is written the way that it is.
The section Sam highlighted clearly conflicts here.
- Gain insight on why the original author wrote the code in this way in the first place, and
And your own comment conflicts here.
My posting here is to understand why someone might write code this way