6
benj
1y

Wow, function overload is worst than garbage! Is more like toxic waste!

If you run out of names for functions just name them:

DoThatStuff1(int, string)
DoThatStuff2(object, int, string)

instead of:

DoThatStuff(int, string)
DoThatStuff(object, int, string)

Your coworkers and future you will thank you!

Comments
  • 13
    If I saw number suffixes in my code base I'd go to my boss and ask politely to have you fired.
  • 3
    @ScriptCoded totallii

    A decent idea gives you perfect autocomplete for this. The number thingy is terrible. Make it descriptive xToYByString or smth...
  • 6
    If you run out of names the solution is not adding random numbers but come up with better names.

    If the function really does the same thing but takes different parameters, overloading is perfectly fine.
  • 0
    Or extract the related stuff to its own file or service
  • 0
    @ScriptCoded I'd ask the same if I see 5 functions with the same name ;-)
  • 0
    I am so happy watching the OOP getting reasonable and parts of the overhead stuff dying off slowly
  • 1
    Funny I come across this rant when I was lamenting the lack of function overload in TypeScript yesterday. Now I see how retarded my code looks because of using type unions as replacement I'll never wonder what its purpose is ever again
Add Comment