Skip to content

Instantly share code, notes, and snippets.

@tuanpmt
Created May 2, 2022 10:27
Show Gist options
  • Save tuanpmt/4a955218f877fc34afeaddfa359e56c2 to your computer and use it in GitHub Desktop.
Save tuanpmt/4a955218f877fc34afeaddfa359e56c2 to your computer and use it in GitHub Desktop.
USE SEARCHABLE NAMES
/* BAD */
for (int i = 0; i < 5; i++)
{
s += (t[i] * 4) / 5;
}
/* GOOD */
int realDaysPerIdealDay = 4;
const int WORK_DAYS_PER_WEEK = 5;
int sum 0;
for (int i = 0; i < NUMBER_OF_TASKS; i++)
{
int realTaskDays = taskEstimate[j] * realDaysPerIdealDay;
int realTaskWeeks = (realTaskDays / WORK_DAYS_PER_WEEK);
sum += realTaskWeeks;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment