I prefer code over comments
userHasPermission = (loggedIn() && hasRole(ROLE_ADMIN))
if (userHasPermission) {
dataIsValid = (data != null && validate(data))
if (dataIsValid) {
...
}
}
That's shorter, introduces terms in reading order (readers do not have to wonder what
if (loggedIn() && hasRole(ROLE_ADMIN)) means before encountering
userHasPermission. Yes, you can write the comment before the if statement, but then, it tends to become longer:
"check whether the user has permission to do this") and less likely to become inconsistent when code evolves.
I see such comments as symptoms of time pressure or a somewhat sloppy, but caring, programmer.