Today I was reading How to ask a good question from the help center of StackOverflow and found this as a good example of a question:
Good: Why does str == "value" evaluate to false when str is set to "value"?
I tend to participate in Java Q/As and a question like this would be automatically downvoted and closed for being a duplicate of How do I compare strings in Java?
And this repeats for other programming languages as well:
- C#: Differences in string compare methods in C#
- Python: Why does comparing strings in Python using either '==' or 'is' sometimes produce a different result?
- Perl: How do I compare two strings in Perl?
- C++: How to compare strings
- C: How do I properly compare strings?
- JavaScript: What is the correct way to check for string equality in JavaScript?, Why does ("foo" === new String("foo")) evaluate to false in JavaScript?, How do you do string comparison in JavaScript?
(and on and on...)
I think this example should be changed. For example, a example of bad/good question would be:
- Bad: cannot connect to database
- Good: Why the database connection doesn't open if I provide the right credentials?
Open to other ideas to replace this example.