I have yet to hear an answer from anyone as to why overloading of any type is a sound programing practice. Calling the same function name with an almost infinite number of variations on the surface and under scrutiny screams "hey this is a error looking for a chance to instantiate itself".

I'll buy the object oriented stuff for some cases, it is easier for most people than pointers and data structures, but the overhead and honestly potential sloppiness of this solution eludes me as to why people think that this is a good idea.

One one hand people say "objects represent real life" objects are good, functional programming bad! The ONLY problem I have with much of this is that objects to many represent the only way to do something. Much like the person who has a hammer, everything looks like a nail. So that to an OOP programmer, Objects are the ONLY tool in the box.

Please could somebody provide a sound answer to my question, without questioning my experience? (I have 30+ years in coding , Virtual and Augmented Reality, Systems Coding, Development, etc)

I'm not trying to be difficult, honestly, I just want to understand!

  • 4
    This question isn't a good fit for this website, because its answers would be opinion based. "One one hand people say "objects represent real life"" OOP has nothing to do with objects, really. Aggregations of data predate OOP by decades. What kind of "overloading" are you talking about exactly? What "potential sloppiness"? I suspect most readers of you question will have no idea what you're referring to.
    – Alexander
    Commented Nov 12, 2020 at 3:11
  • 3
    By claiming wrong accuses against a whole category of professional people I guess you are not motivating our experts here for treating your question weil. For any programmer I take serious, OOP is one tool among others, "objects representing real life" is seen as a false myth, functional programming is neither good nor bad, but just a tool. And the different ways of overloading functions is just the same - a tool which has its place, which can be used and abused like any of the other tools you mentioned.
    – Doc Brown
    Commented Nov 12, 2020 at 6:53
  • 3
    Does this answer your question: Should we rename overloaded methods?
    – Doc Brown
    Commented Nov 12, 2020 at 7:00

1 Answer 1


Because having serialize_int and serialize_float and serialize_user and an almost infinite number of variants that only add uniqueness noise because the language won’t let programmers express what they really want to is its own source of errors.

The days of Java School OO hammers is much diminished. Even in functional style programming, overloading (and dynamic dispatch in particular) lets the programmer be more expressive and clear in their code if it is used judiciously. More maintainable code at the expense of a little compile time and a jump table is well worth it in many environments.

  • 1
    Never-mind that serialize_int, serialize_float and friends will likely be called from a context of switch (some_value.class) { case Int: serialize_int((Int) some_value), ... }. Ad-hoc, error-prone, repetitive hand-rolled polymorphism.
    – Alexander
    Commented Nov 12, 2020 at 13:39
  • Alexander, not really, the name of the method/function is unique, therefore programmer error and maintenance is reduced.
    – jw noord
    Commented Nov 12, 2020 at 18:28
  • @jwnoord I don't see how it is reduced. I once worked on an app where we have a switch with dozens of cases that do exactly this kind of thing. Any function with dozens of switch cases is a maintenance nightmare. Maybe we agree to disagree but I, personally, will never do it that way again. Commented Apr 12, 2021 at 0:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.