Inconsistent code will bite you sooner or later - I reckon sooner ;-)

See this sample interface with some method signatures

void CalculateSalary(string environment, string emloyeeName, ...)

void GetListOfSubEmployees(string environment, string emloyeeName, ...)

void CalculateBonusPerYear(string environment, string emloyeeName, ...)

void GetOrderRegion(string environment, string emloyeeName, ...)

void UpdateEmployee(string environment, string emloyeeName, ...)

void MergePolicy(string emloyeeName, string environment, ...)

As you can see all methods have some common parameters (string environment, string emloyeeName).
But the last method has the 2 parameters switched around.

Because the datatype of these 2 parameters is the same, it is highly possibly that someone will mix those up, since all the others use a different order.

Refactor this, and be a good boy scout: Leave the campground cleaner than you found it

 

PS: The probability that this little inconsistency above bites you, increases with team size and over time!

image

No comments:

Post a Comment

Latest Posts

Popular Posts