Code Smell 57 - Versioned Functions

Subscribe to my newsletter and never miss my upcoming articles

sort, sortOld, sort20210117, workingSort, It is great to have them all. Just in case

Problems

  • Readability

  • Maintainability

Solutions

  1. Keep just one working version of your artifact (class, method, attribute).

  2. Leave time control to your version control system.

Sample Code

Wrong

Detection

We can add automatic rules to find versioned methods with patterns.

Like many other patters we might create an internal policy and communicate.

Tags

  • Versioning

Conclusion

Time and code evolution management is always present in software development. Luckily nowadays we have mature tools to address this problem.

Relations

Credits

Photo by K8 on Unsplash

Original idea


That's why I write, because life never works except in retrospect. You can't control life, at least you can control your version.

Chuck Palahniuk


This article is part of the CodeSmell Series.

Comments (2)

Sep's photo

Thanks for another great writeup 👏

Would really love to see the full article contents in the rss feed.

Maxi Contieri's photo

Thank you.

Feed is developed by Hashnode

I don't have control on the format