I want to question the closing of this question:

Password Validation in Python 3.6

The reason given is "Code not implemented or not working as intended". I can see no evidence that the code is broken to the poster's knowledge: they may need to learn better case analysis and testing rigour but needing to improve is not against the rules, especially for a school student.

Now, I'll totally understand if site policy is we don't want to field anything that isn't up to some minimal professional standard, or perhaps university student and up. Is that the case, and if so where is that standard defined?

If not, I really think we have to assume good faith that people are unaware of their code's failings (except perhaps performance) unless they're complaining about bugs or failed test cases or such.

I have other issues to raise for discussion from this episode, such as the confusingly broad close messages and whether minors need special treatment, but one at a time.

Determining why other people voted to close a post is not reliable, but, I would have also voted to close the post because it is clear that there is a lack of testing, or validation of the code. The issues are so "basic" that it's almost as if they have not run their code at all.

For example, the test:

elif y.upper() == True

will never resolve the way you expect... it converts the y string to uppercase, instead of what I expect the user wants, which is isUpper....

Additionally, the description clearly says: "Passwords must consist of: lowercase letters, uppercase letters, numbers" but there is no check to ensure that each of those character types is used.... the only tests are to ensure that the password is not only one character type (assuming the upper() bug is fixed.

In other words, even the "normal" code paths that are expected to work, don't work. While it may be true that the asker does not know their code is broken ("To the best of their knowledge, does the code work"), I believe even the smallest test case that they should have run just to develop their code, would have shown the problems. A password abc123 should fail, but does not (missing an upper-case letter), and the password ABCDEF should fail, but does not.

So, the real question you ask is whether there is a formal, or even an implied "minimal professional standard", and I believe the answer is yes, there's an implied standard, where the "happy case" is expected to work. This is not a case of broken "edge case", but this is a case of basic expectations not being met in the code.

To suggest there is no minimum standard is to suggest that we allow unreasonable ignorance to pass for lack of knowledge, for example, can you post code that does not compile, just because you never tried to compile it? I.e. missing knowledge due to unreasonable ignorance is not "to the best of my knowledge", but it is "to the not-so-best of my knowledge".

  • The problem is defining "unreasonable ignorance", especially when it comes to school students. Knowing how to write test cases to systematically exercise code is a skill. It's potentially a skill that doesn't even come up (at least particularly early) on structured programming courses; these can emphasize getting people up to speed writing something cool at the expense of teaching them about analysing it. – Josiah Jun 4 at 6:59
  • 2
    Do you think we should require evidence of testing on questions as a general policy? This is a genuine question. "How have you tested your code? Please provide example inputs and outputs if possible." would make the standard explicit if all code path testing is expected. As a bonus test inputs are both useful for review and are a potentially worthwhile component to review, but most importantly I don't mind having minimum standards if we're upfront about what they are. – Josiah Jun 4 at 7:12
  • 1
    @Josiah Your last comment contains a question which could be a good feature-request. Feel free to post a new meta question about it. – Mast Jun 4 at 11:25
  • @Josiah - having good test cases available for the reviewer is something that I believe differentiates an OK question from a good one, and is reflected in the way I upvote questions. Also, we are upfront in the minimum standards, to an extent, we require that the code accomplishes the task it's intended to do. This is a subjective test, and is sometimes controversial, but it is there., – rolfl Jun 4 at 11:39
  • 1
    @Josiah A test-case doesn't necessarily have to mean an automatic test. To me it is clear that this code hasn't been tested enough with manual tests. Also note that there is no question in the question - Is the OP asking here for a Code Review or for us to help them with their known problem? Judging by their code, I believe they asked here for help with the implementation. – Simon Forsberg Jun 4 at 13:52
  • @rolfl, this is exactly what I'm asking about. It seems that Jamal has edited the title to be specific to this post, but I'm asking whether there is an external standard. The current test is not just subjective but subjective in a way only the asker can answer: "To the best of my knowledge, does the code work as intended?" My contention is that, especially when dealing with very junior and potentially very young developers, the best of their knowledge may genuinely not reach things we assume everyone knows. We should either trust them to self-report, or change the rule. – Josiah Jun 4 at 19:08

You must log in to answer this question.

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