DEV Community

Discussion on: Code Smell 57 - Versioned Functions

Collapse
yoursunny profile image
Junxiao Shi

What if:

  • It's a C function, where optional arguments are not supported.
  • A new version of the function adds an extra argument.
  • Old version cannot be deleted because it would break dependants.

The only way is to keep both old and new functions.

Real example: pipe and pipe2 in Linux syscall

Collapse
elmuerte profile image
Michiel Hendriks

That doesn't change the fact that it is a code smell. Sometimes language or runtime restrictions make code smells unavoidable.

Collapse
mcsee profile image
Maxi Contieri Author

Many bad languages introduce unavoidable code smells

We should be aware of them