Repeat Yourself Early And Often

time to read 2 min | 341 words

RYEAO (Pronunciation: it just sounds like cat when you step on it's tail) is the only thing that comes to my mind when I see things like:

public class Employee
{
   public int EmployeeID { ... }
   public string EmployeeName { ... }
}

You really want to make sure that you're dealing with an employee here, I guess. I see if often in databases, where is sort of make sense (for matching primary key to foereign key, maybe?), but I can think of very few situations where it would be helpful.

Here is one of them:

public void PayEmployees()
{
  foreach(Employee emp in EmployeesList)
  {
    // 765 lines of code
    Debug.WriteLine("Paid: " + emp.EmployeeName + " " + amount + ".");
  }
}

And this has enough problems of its own as it is.