In linguistics, semantic overload
occur when a word or phrase more than one meaning.
overloading
Ability to create multiple functions of the same name with different implementations.
polymorphism
.function getInfo(value: string | number): string | number { if (typeof value === "string") { return `Hello, ${value}!`; } else if (typeof value === "number") { return value * value; } // handle unexpected types throw new Error("Invalid type"); }
// overload (good), same function names function Person[] FindPersons(string nameOfPerson) { ... } function Person[] FindPersons(date dateOfBirth) { ... } function Person[] FindPersons(int age, string dogsName) { ... } // non-overloading unique functions (bad) function Person[] FindPersonsByName(string nameOfPerson) { ... } function Person[] FindPersonsByDOB(date dateOfBirth) { ... } function Person[] FindPersonsByAgeAndDogsName(int age, string dogsName) { ... }
You get consistency in naming, but at the cost of ambiguity about exact implementation.