home..

The TSA and the Case of the Missing Boundary Condition

Agent A: “But it isn’t shorter than 4 inches, so we have to confiscate it.”

Agent B: “No, it is only prohibited if it is longer than 4 inches.”

Agent C: “Maybe you measured it wrong.”  Takes ruler and meticulously measures it again. ”Nope, it is exactly 4 inches.”

Passenger: “Could you please just confiscate my scissors so I can catch my plane?”

I waited in line as the agent consulted with every other TSA employee working at the gate. All of them were dumbfounded and unable to resolve the issue. What was this dire security issue that required all of their attention? A pair of scissors with a blade of exactly 4 inches.

Since the passenger was willing to just give up the item, the issue eventual resolved itself. While I am typically annoyed with airport security, I found the above exchange humorous. Although I assumed the issue was that the agents did not fully know the rules, I was curious enough to check when I had the chance.

According to the TSA’s official list of prohibited items, “…blades shorter than 4 inches are allowed, but blades longer than 4 inches are prohibited.”

The author of the ruleset had actually managed to write a rule that did not cover all possible sizes for a pair of scissors.  If they had simply stated either the first part or the second part, there would have been no issue.  The more I thought about it, though, the more I realized issues like this arise quite often in computer programming too.

Imagine the TSA has asked you to develop a program to handle the scissor length checks. A direct interpretation might result in a statement like this:

if( length(scissors) < 4.0 )
    // everything is ok 
else if( length(scissors) > 4.0)
    // Danger!

An experienced developer might realize the stupidity of this implementation since the boundary case of 4.0 is not handled. Instead they may write

if( length(scissors) < 4.0 )
    // everything is ok
else
    // Danger!

Now the boundary case is handled because else is left to just take care of everything that is left. Another developer in the exact same situation may write

if( length(scissors) > 4.0 )
    // Danger!
else
    // everything is ok

The boundary case is still handled, but in a different manner. Given the TSA’s specifications, all three programs would be reasonable implementations. Each performs identically except for a very specific boundary case.

The handling of boundary issues is not just the domain of the TSA; nearly anyone who codes a function will have to make similar decisions. While it may not always be important how boundary cases are handled, they should be handled. One of the benefits of using humans for certain tasks is that they presumably can handle ambiguous cases. Though the TSA may not want to rely on this since they obviously are not hiring their employees for their critical thinking skills.

Comments? Send me an email.
© 2023 William Hartmann   •  Theme  Moonwalk