4
blem14
6y

Disclamer: I don't want to give out what app I am talking about, so all names will be random to just represent the nonsense and my frustration.

So I was working with that app's API....
To begin with, some retrieved Objects have collection (iterable structure) of "Thing" objects, called "Things". But... there can be max one element in that particular collection!
Ok... I get it... I might exaggerate a bit... fine, let it be.
I had to mention it for the further part, and also got to mention that "Thing" objects are globally available and predefined, and Objects can only choose one, unused "Thing".

To the point.
Someone thought it would be good to separate representation of one structure into two classes.

We have collection of "A" objects ("As"), which have "Name", "Things" and other, mostly GUI/config related attributes.
Collection "Bs", of "B" objects, they have "Name" and rather lower-level attrs.
The "As" and their attributes can be set in the GUI, but the list where you do it is named "List of Bs" and vice versa.
Interesting, huh?

I had to use both "A" and "B" definition for given name, so I tried to map it... and things gone South.

Collecions have "Get" method with name as an argument.
But it turns out that while the "A" use its GUI name all the time, "B" uses either name that can be found in "As" or, if not all "Thing" objects are used, the "Thing" names.

Example:
global "Things" = "t0", "t1"

"As" = "a0"("t0"), "a1"("t1") -> "Bs" == "a0", "a1"
"As" = "a0"("t0"), "a1"() -> "Bs" == "a0", "t1"
"As" = "a0"(), "a1"() -> "Bs" == "t0", "t1"

That means if at least one of "A" objects have empty "Things", then the mapping will fail.

Only solution is that the app works only partially when any of "A"'s "Things" is empty, so I might raise error too, but I have to provide solution that will work even in the cases when the app don't care... so... not gonna happen.

Comments
  • 1
    This sounds like that horror movie, “The Thing”😱
Add Comment