Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

11
  • 2
    but in C# we can just say string.IsNullOrWhitespace(s) :p Commented Jan 19, 2012 at 15:04
  • 47
    I agree that code should be as small as possible but wouldn't generally argue that less characters is always better code. When it comes to variable naming for example, a reasonable amount of characters generally result in better names than just using i and j. Commented Mar 28, 2013 at 11:23
  • 4
    @Markus That highly depends: for a loop variable representing an index, i is better than a long variable name. Even more general, shorter variable names that convey the same information, in the same clarity, are always preferable. It’s just that to express the necessary information you need a certain character length, and I’m not denying this (nobody is). Commented Mar 28, 2013 at 11:29
  • 2
    @Konrad: i is a good variable name only if the loop is small and it doesn't contain any other indices. But I agree that if sth. can be stated more briefly conveying the same information, that would be preferrable, like in the string.Empty / "" case. The string.Empty does not add any clarity. Commented Mar 28, 2013 at 13:01
  • 5
    To me: string.Empty says this string is and should be Empty at all times, whereas "" says at the time of writing this string could be empty but you are free to change it. Commented Aug 13, 2017 at 13:59