3

Let's say my language's standard library does not include TrickyFunction(). Since implementation seems quite trivial for me, I decide to create utils in the project and add such function, for others to use.

Next month another programmer requires TrickyFunction. He doesn't expect it to exist, so instead he downloads and installs a library.

Year later, I require this function once again. However, I forget about the utils I've created and I instinctively google it. Unfortunately, positioning in google has changed and now another library is on top spot, introducing FunctionTricky which I install without a doubt.


Is there any way to signal to future self and other programmers: "In this project, we handle this problem with such solution"?


Things to consider:

  • This issue can overlooked even during a code review, if I forget that I've added this function a year ago.
  • Functions can be named differently in alternative libraries
  • Utils folder can grow large, especially when working with new frameworks, where extra libraries does not exist yet.
7
  • Did you mean to transpose the words from TrickyFunction to FunctionTricky in "Unfortunately, positioning in google has changed and now another library is on top spot, introducing FunctionTricky which I install without a doubt."? Nov 7 at 2:28
  • Handling 3rd-party libraries and utils in such a way (by "Google and install") is just plain wrong in this and a gazillion of other (mainly legal and security) ways. I think you should start there to fix this.
    – tofro
    Nov 7 at 7:50
  • @GregBurghardt Yes, my intention was to show, that code completion will not be helpful, if function is called differently in other libraries. Usually typing tricky will suggest oneLibrary.tricky() as wells as second.tricky().
    – JoshThunar
    Nov 7 at 11:22
  • Issue appears when one library calls it normalDistribution() and second gaussianDistribution()
    – JoshThunar
    Nov 7 at 11:30
  • 1
    Does this answer your question? How to promote code reuse and documentation?
    – Doc Brown
    Nov 7 at 21:41

0