Comment on I am God's greatest programmer
BaardFigur@lemmy.world 1 year agoHow do you even fix it, when the design is broken. Sure you can make an alternative function, without all the warts, but how do you convince the “seniors” to not use the old functions, because it is in fact problematic for various reasons.
We have a separate C-library that returns all strings by ringbuffer. Why is that a problem? Call into the ringbuffer enough times, and it will wrap around, overwriting earlier strings. This, and other bad code practices such as broken multi-threaded code (not threadsafe), and more.
CodeMonkey@programming.dev 1 year ago
If you are creating an alternative implementation and leaving the old one in place, you are not fixing a problem, you are just creating a new one (and a third one because you have duplication of logic).
Either refactor the old function so that it transparently calls the new logic or delete the old function and replace all the existing usage with usage of the new one. It does not need to happen as a single commit. You can check in the new function, tell everyone to use it, and clean up usage of the old one. If anyone tries to use the old implementation, call them out in a code review.
If removing or replacing the old implementation is not possible, at least mark it as deprecated so that anyone using it gets a warning.
BaardFigur@lemmy.world 1 year ago
It wish it was that easy. It is a deep rooted problem, because of several other factors.
There’s not just one function that is l dependant on the ringbuffer, but multiple functions in multiple libs and dll’s. Some if these dll’s and libs are used by us, some are used by another department and some are used by both. The other department is using pInvoke to call it from a C#-application, or from other dlls. We use it as library in a C+±application, but it might also happen indirectly by calling to other dll’s. A proper fix is therefore an immense task, and requires coordinations between multiple teams.
Needless to say, it’s easier to just phase it out instead of turning everything upside down
magic_lobster_party@kbin.social 1 year ago
I’m sure that ring buffer started out as a “temporary solution”.