please hate it http://hatepaste.com/paste/155205ac
Weekend project: A place to post crappy code. HatePaste
11–20 of 33 posts
Re: Weekend project: A place to post crappy code. HatePaste
#12It's interesting that this is one of the most hated ( http://hatepaste.com/paste/f5da3584 ): if (someBoolean == true) { doSomething(); } I got into the habit of doing this since it's immediately obvious that the value you're comparing is expected to be a boolean and not something like an integer, which could cause subtle bugs later on if what you thought was a boolean gets negated. More commonly, it's of the form: if…
if (someBoolean)
Are unambiguous.Re: Weekend project: A place to post crappy code. HatePaste
#13It's interesting that this is one of the most hated ( http://hatepaste.com/paste/f5da3584 ): if (someBoolean == true) { doSomething(); } I got into the habit of doing this since it's immediately obvious that the value you're comparing is expected to be a boolean and not something like an integer, which could cause subtle bugs later on if what you thought was a boolean gets negated. More commonly, it's of the form: if…
Ofcourse, your example probably applies to JavaScript since anything and everything can be a boolean, or not depending on the phase of the moon. In Java at least if not someBoolean is nice to read, and if (isGood) is nicer than if (isGood == true).
Re: Weekend project: A place to post crappy code. HatePaste
#14Re: Weekend project: A place to post crappy code. HatePaste
#15It's interesting that this is one of the most hated ( http://hatepaste.com/paste/f5da3584 ): if (someBoolean == true) { doSomething(); } I got into the habit of doing this since it's immediately obvious that the value you're comparing is expected to be a boolean and not something like an integer, which could cause subtle bugs later on if what you thought was a boolean gets negated. More commonly, it's of the form: if…
In Java, it's a compile error to pass something not of type `bool' into that expression, so things like if (someBoolean) Are unambiguous.
Re: Weekend project: A place to post crappy code. HatePaste
#16It's interesting that this is one of the most hated ( http://hatepaste.com/paste/f5da3584 ): if (someBoolean == true) { doSomething(); } I got into the habit of doing this since it's immediately obvious that the value you're comparing is expected to be a boolean and not something like an integer, which could cause subtle bugs later on if what you thought was a boolean gets negated. More commonly, it's of the form: if…
Its far easier to read if (!someBoolean) than if (someBoolean == false) Ofcourse, your example probably applies to JavaScript since anything and everything can be a boolean, or not depending on the phase of the moon. In Java at least if not someBoolean is nice to read, and if (isGood) is nicer than if (isGood == true).
Some people prefer verbosity over brevity, just like some people prefer K&R braces to Allman, or CamelCase to underscoring.
Re: Weekend project: A place to post crappy code. HatePaste
#17I love social coding, because there is so much hate.
Re: Weekend project: A place to post crappy code. HatePaste
#18It's interesting that this is one of the most hated ( http://hatepaste.com/paste/f5da3584 ): if (someBoolean == true) { doSomething(); } I got into the habit of doing this since it's immediately obvious that the value you're comparing is expected to be a boolean and not something like an integer, which could cause subtle bugs later on if what you thought was a boolean gets negated. More commonly, it's of the form: if…
Re: Weekend project: A place to post crappy code. HatePaste
#19It's interesting that this is one of the most hated ( http://hatepaste.com/paste/f5da3584 ): if (someBoolean == true) { doSomething(); } I got into the habit of doing this since it's immediately obvious that the value you're comparing is expected to be a boolean and not something like an integer, which could cause subtle bugs later on if what you thought was a boolean gets negated. More commonly, it's of the form: if…
if (true == someBoolean) {
// code
}