3 ms·
what do you mean by bijection/bijective in the context of refactoring and iteration?
by perfmode 8y ago
what do you mean by bijection/bijective in the context of refactoring and iteration?
- jessaustin 8y agoPresumably GP meant that the mapping from old ShipID to new ShipID must be injective. Bijective would also work, but if the mapping were merely surjective there could be multiple entities in the old code mapped to a single entity in the new code. That seems sure to cause problems.
- stcredzero 8y agoActually, a surjection might result in a refactoring in the pedantic sense. Also, some refactorings work out to be surjections.
- stcredzero 8y agoRemapping ShipID from string to a struct of two 64 bit integers is bijective. No information was lost in that transformation, and I can reverse it at will. The following is a bijection. It is reversible. A ---> a B ---> b The following is not a bijection. It is not easily reversible. A ---> b B ---> b So for example, if I rewrite all occurrences of "ShipID" to be "string," those occurrences get lost among all of the other uses of "string." I could always go back to git and back out the change, but what happens in the future, when those changes have become interspersed with other changes?