Skip to content

Instantly share code, notes, and snippets.

@rubdottocom
Last active April 28, 2019 06:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubdottocom/f5b89ae3f6e6ba260d10432d839a71cb to your computer and use it in GitHub Desktop.
Save rubdottocom/f5b89ae3f6e6ba260d10432d839a71cb to your computer and use it in GitHub Desktop.
Clean code examples
// Originally posted on: https://rubdotto.com/clean-code-nombre-de-variables/
public boolean isSS(int r, int hc, int e) {
if (r != 3) {
return false;
}
if (hc != 0xFFFFFF00) {
return false;
}
if (e < 1000000) {
return false;
}
return true;
}
// Originally posted on: https://rubdotto.com/clean-code-nombre-de-variables/
public boolean isSS(int race, int hairColor, int energy) {
if (race != 3) {
return false;
}
if (hairColor != 0xFFFFFF00) {
return false;
}
if (energy < 1000000) {
return false;
}
return true;
}
// Originally posted on: https://rubdotto.com/clean-code-nombre-de-variables/
private static final HUMAN = 1;
private static final NAMEKIAN = 2;
private static final SAIYAN = 3;
private static final MINIMUM_ENERGY_REQUIRED = 1000000;
public boolean isSuperSaiyan(int race, int hairColor, int energy) {
if (race != SAIYAN) {
return false;
}
if (hairColor != Color.Yellow) {
return false;
}
if (energy < MINIMUM_ENERGY_REQUIRED) {
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment