Tuesday, December 19, 2006

Parabola

The airport security line wound its way like an amusement-park ride through Terminal C. The line was moving caterpillar-like, unhurried.

Some of the people in the line fidgeted and stared every direction, measuring the caterpillar's progress by the big clock on the wall. These were the passengers whose flights were leaving soon. You could read each passenger's face and in an instant know how desperate he or she was. The desperate ones plainly wished the big caterpillar would hurry up.

But most passengers, like the caterpillar they formed, shuffled along with that particular type of stoic boredom you only find in airport security lines and waiting rooms at the Department of Motor Vehicles. Most of them simply switched off, and did their best to leave their bodies behind while the minutes ticked by.

A little sign by the velvet-roped entrance told arriving passengers the wait was 45 minutes.

At this moment the line was in perfect working order, and nobody was more contented by this than T.S., the big security guard at the caterpillar's head. T.S. had worked in this airport for twenty-two years, doing exactly the same job, and one of the great satisfactions of his life was that each year things became more orderly. There were rules and laws and airport regulations governing every conceivable aspect of the operation of his security-line.

Whenever an inconceivable thing happened, which is to say that some sufficiently clever or desperate passenger found a hole in the rules and made things temporarily disorderly, they'd have a new rule for just that situation by the very next day. After more than twenty years of such additions, the regulations manual was thick and heavy with special cases.

T.S. had memorized every rule in the thick blue security-line manual. He knew all the rules because he had helped make most of them, and his job was to enforce them.

Years ago the rule book was just a tiny thing. It was the kind of rule book you'd write if you had grown up watching black-and-white movies in which people were mostly good, honest, and wholesome. The early rules were just common sense. But over the years, after people had tried to get on the plane naked, or had shown up drop-dead drunk and vomited on other parts of the caterpillar, or had tried to sneak their fireworks onto the plane for the big Fourth of July celebration, the rule book had become massive and daunting.

T.S. needed a special rule for each possible way to break the orderly workings of the line, because otherwise people would argue endlessly. You had to show them that it was written down, a real rule, before they'd listen.

On most days the big rule book was sitting on a black shelf upstairs by the coffee machine in the Terminal C security office. T.S. didn't need it. He was a walking, talking version of that book, and passengers knew this without needing to be told. T.S. looked like a rule book. Plus the rules were still mostly common sense, so the passengers all knew the important bits. You stood in line until it was your turn to show your pass and ID, and then the guard would let you go take your shoes off and put your things on the conveyor belt. There wasn't much to it, if you behaved yourself.

Most passengers breathed a deep sigh of relief once T.S. waved them through the gate. They might think it was due to the sudden relief from the boredom of being a caterpillar segment, but it was more often because they had been holding their breath while T.S. was examining their paperwork. He looked a little scary. After you got past T.S., you didn't have that warm feeling of being one of the good guys. You felt like you had narrowly escaped being in trouble, and that you were really hiding something, but you had escaped detection this time. Somehow T.S. managed to make almost everyone feel guilty.

T.S. surveyed the line about every seven seconds, the way you might glance habitually in your mirrors while driving. He could read the line in an instant, could spot potential troublemakers before they even knew they were planning to make trouble. T.S.'s job was to examine the boarding pass and identification for each passenger, but he also had broad responsibility for keeping the line moving and orderly.

Nobody got past T.S. without the right credentials. No exceptions.

A dark-haired woman arrived at the back of the line, breathless, towing a young boy who might have been her son. The woman was wearing a dark blue dress covered in nice white dots, with small ruffles on the shoulders. She had no luggage: just a black handbag in one hand and the boy in the other. There were hundreds of people in the line, and others walking around the terminal, but T.S. began watching the dark-haired woman from the moment she rounded the corner. He knew she was going to be disorderly. It was on her face, in her wide eyes. The only question remaining was how long it would take him to quiet her down and get her to stand in the line like everyone else.

The woman and boy were making their way up the shortcut lane, the one reserved for airline personnel. T.S. had seen this play out a thousand times, and not one time in a hundred did the passenger actually have the right paperwork for being in that lane. But troublemakers always wanted to use the shortcut lane. They always wanted to talk to him. They didn't understand how the system worked. Troublemakers always thought they were special cases.

The woman and the boy made their way up to T.S. and waited for him to finish with the current head of the caterpillar, a family of four apparently headed for a ski trip. T.S. ignored the two newcomers in that special way only a career administrator can muster, by suddenly taking a keen interest in his own work. He smiled kindly at the father of the family, looked again at their four passports and boarding passes.

The father of the family smiled back nervously and held his two children very still. His wife smiled as well, wide-eyed and alert. They knew they had been made lucky by the sudden appearance of the dark-haired woman. The big security guard with the initials T.S. on his name tag was going to take a little longer with the family, but it was only a gesture. The guard had to show everyone in line that people who abuse the shortcut lane have to come away with a clear net loss of time. This would necessitate a more leisurely inspection of the ski-trip family, who knew they had just been granted a temporary immunity from T.S.'s suspicion. T.S. would treat them almost politely, as long as they played along. This was one of the rules that wasn't written down, but everybody knew how it worked.

The other passengers in line began to watch closely, with interest. There was clearly going to be a showdown. That big security guard hadn't smiled once in the last 45 minutes, and he was only doing it now to show just how thoroughly he was ignoring the woman and child. The crowd wanted the dark-haired woman to lose the showdown and slink to the back of the line, because it was clear she didn't have one of those magical Shortcut Lane passes that nobody ever gets. She wasn't acting confident enough to have one of those. She looked nervous, almost sad, like she knew she'd never make it through.

T.S. addressed the father for the first time. "Ski trip?"

The big guard asked his question curtly. It was a ritual. He was permitted one question for every few passengers. This was another Unwritten Rule. Sometimes security guards had to ask questions, because you could find bad guys that way. It happened in the movies all the time: a first-time bad guy always spilled his guts if a cop asked him a stern question. First-time bad guys are always nervous in the movies. So even though T.S. was technically only supposed to check credentials and either wave people through or send them back to the ticket counter, he could get away with asking spot-check questions now and again, as long the conveyor belts behind him never starved for bits of caterpillar. And he was using up one of his free bad-guy questions on the family, to make a point.

The father knew the game and played it gladly. "Yep. Aspen. We can't wait." Everyone watching knew that he was really saying: "Please shoot that dark-haired woman instead of me. She's one of those Shortcut-Lane bad guys." Everyone knew T.S. would nod and smile and let the family through then, so that's just what he did.

T.S. was feeling momentarily magnanimous. "Have yourselves a good time, y'hear?" The family gratefully took their papers and squeezed through the gate and into the x-ray area beyond.

Now it was time to deal with this troublemaking woman. The caterpillar stopped shuffling as everyone strained to watch.

"Can I help you, miss?" There was no reason not to be polite. Not yet. T.S. prided himself in his fairness to troublemakers.

The dark-haired woman was clutching a handwritten note. She presented it to T.S. "Yes, sir. I have this note from the manager at the ticket counter. She said to show it to you, and said we should go through the shortcut line."

T.S. didn't bother taking the note. Handwritten notes never, ever constituted valid credentials. He didn't even look at it. He made a dismissive turn back to the new head of the line, and replied: "I'm sorry miss, but without a lane pass, you need to stand in the regular line. Like everyone else," he added pointedly, nodding at the good people forming the long caterpillar. They were all good people now. T.S. was feeling generous today. Restoring order always made him feel grand.

The boy with the woman started to look very worried. "Mom, are we going to make it? Are we going to get to see Dad?"

The woman pulled the boy closer to her, and she gave the second speech she had rehearsed on the way to the guard. "Sir, the ticket counter is all out of lane passes, but the agent at the counter and her boss said that you could call them if you had any questions. My son and I need to get on this plane, and it's leaving in less than ten minutes. They wrote this note for me. They said it's a temporary lane pass that I should give to you."

T.S. was unmoved, and turned his back to the woman and her son, taking the next passenger's boarding pass. He would keep talking to her, for a little while anyway, but it should be clear to her that the conversation was over and that she would be leaving very soon. The people in line were on his side. The ticket counter agents might try to help a late passenger, but they could only do so much. The woman was just unlucky today. They were out of lane passes, so she was going to have to wait in line. The showdown was over.

The dark-haired woman played her last card. "Please, Sir, listen to me. My husband has been in an accident. The Red Cross notified us this morning. My son and I need to see him, we need to see him. They say my husband is in critical condition, and that he might..." she broke off and bit her lip, looking down at her son.

She considered for a moment. T.S. nodded the next person through and turned back to her.

"We need to see him very soon, and the airline counter contacted the Red Cross and got me set up on this flight. It's leaving in 10 minutes. They gave me this note to give to you. Please take it. We have our boarding passes and identification. If you don't let me through, I may not get to see my husband... today," she added quickly, hugging the boy.

The passengers looked from T.S. to the woman. Her revelation was very serious news. Most of the waiting passengers were willing to accept her story at face value. You don't make up a story like that. Not when you're a woman with no luggage and a small boy, not when you've offered to call the ticket counter over. This woman was clearly an exception to the rules.

That was another unwritten rule: all rules can be bent. Everyone in line knew it. This was one of those times. The caterpillar leaned forward, towards the guard, urging him on. Without speaking, they let him know it was time for him to act. He had lost the showdown after all, and they all still had their planes to catch.

T.S. looked the dark-haired woman up and down. She was clearly in a great hurry and had not taken any great pains with her cosmetics today. But she was in fact quite beautiful, with bright eyes, long dark lashes, and long curls. T.S. guessed she might have been of Spanish or Italian descent. He had never been to Spain or Italy, and could not have told you which one was bigger or closer to the United States.

The dark-haired woman was neither Spanish nor Italian. She had been born in Bangalore, India, and she had come to the United States and, against all odds and expectations, had fallen in love with a Pakistani man, and they were married with one son, the boy at her side. Both she and her husband were computer programmers. They were brilliant, and they were fiercely devoted to each other.

T.S. could not have named three differences between India and Italy. They were as alike to him as Austria and Australia. They weren't in his airport and they weren't in his rule book. His mind raced, as evidenced by a slight slacking in his jaw.

T.S. knew he was in a bind, because he sensed that the woman might actually have gained some credibility with the people in line. Her story didn't matter to him in the least bit, and he didn't stop to consider whether he believed her. His concern was the caterpillar: his audience. T.S. viewed himself as more than a gatekeeper and a peacekeeper. He was the big show, the main event for the segmented bug creeping its way through the velvet ropes. They were a captive audience, but a real audience nonetheless. T.S. believed that the line looked up to him for protection, and feared him a little as well, on account of their all being potential rule-breakers.

So what should he do about this woman? He didn't have any way to call the ticket counter, and there was no protocol for it in any case. Calling the ticket counter would hold up the line. The overriding rule was that each segment of the caterpillar needed to conduct its business in a few seconds or be turned away. His audience ought to know that. It's another Unwritten Rule. But they suddenly seemed sympathetic to this lane-hopper woman with her scribbled note, which was probably a forgery. It all should have gone smoothly, but the woman with the dark hair and dark dress was unexpectedly articulate, and she had somehow swayed the onlookers in just a few short breaths.

He opted for faux sympathy. "Ma'am, I do sympathize with your situation, but I'm not in a position to call the ticket counter." He took the next passenger's boarding pass, to show that he didn't sympathize so much that he'd stop the line for her, and continued: "Now, you have two options."

Giving them Options was generous. It also let T.S. show off his profound knowledge of the Rules. When disorderly passengers were given Options, they usually understood that he was giving them a way to back down without losing too much face. It was OK for them to be ignorant of the rules; only a professional like T.S. could be expected to know them all. Presenting Options permitted a troublemaker to thank T.S. for the information - loudly, for the benefit of the caterpillar crowd, so they'd know no face had been lost. Then the troublemaker could pretend to go off and take care of things, before slinking to the back of the line. It was win-win.

"Your first option is to bring me back a genuine Lane Pass. I'm afraid I can't accept any handwritten notes. One of the other airlines' ticket agents might have one that your agent can borrow." He was warming up to the explanation. His generosity would win the crowd back, the woman would leave with her dignity intact, and he would be King for the next 45 minutes. If only there were some way to video his performance for the benefit of people not yet in line.

"Your second option is to stand in this line. If nobody holds us up," he paused a moment, giving his implication time to sink into the caterpillar, "the line is moving along pretty quick, and I expect you've got a good chance of making your flight and seeing your..." He struggled, having forgotten the details of her story. "Seeing your friend."

The caterpillar recoiled in horror, and T.S. knew he'd made a terrible mistake. He remembered and quickly added: "...your husband, I mean." But the damage was done. All semblance of sympathy was lost. He had alienated his audience utterly. It was a good thing he wasn't on video; this would all be forgotten in 45 more minutes.

The woman looked desperately at the people in line. "Is anyone here a programmer?" she asked. Time was short.

A heavy woman standing in the second fold of the caterpillar answered the implied question: "Have you thought about maybe using the debugger? Sometimes they have a back port you can connect to. He might have a bypass flag."

The dark-haired woman considered for a moment, then turned to T.S., who had delivered his Options speech and was now ignoring her. She pulled out a long metal rod with some red and green LEDs built into it. It had a thick cable attached, leading back into her handbag. "Sir, is there any chance you might be able to bend over for a second and, um, let me put this debugger in your... back, ah, port?"

T.S. had an idea what she meant, and his face broadened into a wide, wolfish grin. "Lady, you try a stunt like that, I might actually get to use this here nightstick for the first time in seven years." He patted the black baton at his hip.

A bronze-colored man with a huge dark mustache near the front of the second bend chimed in: "I don't think you can attach the debugger to these systems in production. They've talked about it, but there are some performance and stability issues."

The dark-haired woman put her rod away. She was now exhausted and on the verge of tears. T.S. continued to wave people through, and a teenager who had just rounded the last bend suggested: "Have you thought about just rebooting? You could change his bypass logic and recompile."

The woman behind the teenager, a portly woman with short spiky blonde hair, immediately shrieked: "How about I reboot YOU, you rotten skunk, and see if YOU come back up? I'm almost through this line and I'm not about to have to come all the way through that parking lot again, go through that ticket line again, and stand in this damn line again! No rebooting, and that's final!" The teenager hung his head, abashed.

The bronze man touched his mustache and offered tentatively: "He's written in Java. Have you thought about using reflection? You might be able to find a way through that way."

The dark-haired woman nodded and sighed. "Thanks. I'm Anushri, by the way. I really appreciate your patience." She said this to him and the others in line.

The bronze-colored man replied: "I'm Delmore. Good luck to you. We'll wait." The rest of the caterpillar nodded their agreement. This woman, Anushri, she had to get on that flight. It really was life or death. It wasn't a laughing matter. There had to be a way to make an exception for her.

Her son was now very worried and looked like he would cry. "Mom, are we going to make the flight?"

Anushri stooped down and hugged her son, and said to him: "We are going to try, Bibi. I'm sure your father will be so happy to see us! But I must hurry and convince this guard to let us through, or we will miss this flight and we will have to find another."

She stood abruptly and faced T.S., who was shuffling his lost audience through the gate as quickly as he felt he could manage safely. Her voice took on a tone of command. "What are your methods?"

A young teen in a white t-shirt near the back of the line shouted: "man, that's the lamest crap-ass API I ever heard! Who the hell designed this loser?"

Another teenager yelled: "I think he forgot reeeeadNuuuuudieMaaaag, hahahaha!" The crowd tittered. Anushri ignored them and remained intently focused on T.S.

As she considered her next query, one of the guards beyond the gate, in the x-raying area, noticed the commotion and walked over. "Hey Type, you doin' OK? Everything in order over here?"

T.S.'s eyes refocused. "Yup. She ain't gettin' through. She can try her fancy reflection tricks, but rules are rules, and she doesn't have the bypass." T.S. turned back to examining boarding passes and waving people through. The second guard nodded knowingly and returned to the x-ray machines.

Anushri spoke suddenly, with the same metallic command note in her voice as before: "Arguments to checkCredentials!"

This time T.S. was unfazed, and continued to check identification as the words barked mechanically from him: "PassengerProxy, CredentialFactory."

The crowd was surprised. The blonde woman muttered: "Credential factory? How the hell does anyone get through this line? Why doesn't the API just take a Passenger?" There were murmurs of agreement as everyone waited to see what Anushri would try next.

Anushri thought for a moment. Chasing the chain of wrapper objects would take her too long. The flight gates would close in maybe five minutes, maybe less. She thought of her husband. He was such a great programmer, and so conscientious with his testing... wait! That was it!

Her voice, suddenly like gears grinding, commanded: "What is your Unit Test API?" If he had a unit test, then there was probably a way to substitute special bypass logic.

T.S. smiled this time: "Ain't got one -- not on a production box, anyway." His big smile was meant to be disarming; he was still trying to woo the crowd. But looking at him was now positively chilling. The next person through the gate snatched back his boarding pass as if it were about to go into a paper shredder.

Anushri was crushed. She held her son tight to her. She'd been brave, but the tears finally came. She wept for her husband in the E.R., for her son who might never see his father alive again. "You bastard!" She railed against T.S., hopeless and defeated. "Why couldn't they have written you in JavaScript!"

Delmore, who was nearing the front of the line, took pity at last. He turned to the crowd and said to them: "Folks, this woman has to get on her plane. She has to, and you all know it, and it's almost too late. Mr. System here isn't going to let her through, and we've all seen firsthand how pathetically inflexible his interface is."

He paused and looked them all in the eye. The crowd was defiant by now, and they returned his gaze. "There's only one way through this jerk, and it's through this line. And that means we can't be in it."

Delmore stepped backwards, over the velvet rope. Two tall crew-cut men next to him did the same. Soon the whole caterpillar was dismantling itself as the crowd clambered away, clearing a path.

T.S. waved the last caterpillar-head through, and the line was now gone, his audience all staring at him expectantly. The big guard couldn't think of much to say, so he called out: "Next!"

Nobody moved.

Delmore beckoned to Anushri. She and her boy walked up to T.S., who smiled triumphantly. He had won. Nobody had broken any rules. The dark-haired beauty and her son had their boarding passes and IDs; all was in order. He waved them through. "Next!"

Anushri and the boy raced to the x-ray machine. It looked as if they were going to make their flight after all. The caterpillar re-formed as people silently found their places again.

Forty-five minutes later, not a soul in the terminal remembered the events of the previous hour, save for the guard T.S., and he was already forgetting it all rapidly. After all, no rules had been broken. He had performed his duties to the letter. The line was orderly, and the terminal was secure.

There was no need for loopholes, no need for exceptions. The system was working precisely as it was designed to work. The caterpillar flowed lazily, like a river. T.S.'s mind settled into his work.

Some time later, T.S. noticed a young girl standing at the head of the shortcut lane. He'd seen her head bobbing around at the end of the security line a while ago. That was one of the sure-fire signs of a troublemaker: they always started by bobbing around, looking to see if there was some way through other than the Line.

The girl began shyly: "Sir, they're all out of Lane Passes, but my plane is leaving in 15 minutes..."

54 Comments:

I theorize that there was something about this blog that was supposed to tell me something non-completely-obvious about programming (Otherwise, why the programming references?). However, I have no idea what it was. I hereby submit a request for enlightenment to the world at large.

Elliot, T.S. is type safety. The system in the story is statically and strongly typed, and it can only handle the situations that its designers anticipated. The users have to hack around its type safety to handle real-world situations (like breaking up the entire queue to let one item pass).

(Apologies to Steve and everyone else if I'm just totally confused. :)

Nice well-written story, but geez, having written so much, you could have at least related it to the point you were trying to make. Sorry if I sound ignorant, but I think you do owe it to your readers who may not necessarily be in the same frame of mind as you are.

Halfway through the story, I was almost sure that you were going to talk about rigid organizational processes when suddenly the characters started talking about programming.

notheory: It's the paradigm shift that jars the reader. If the organizational rigidity metaphor had been maintained consistently, the story would have flowed holistically and been open to any type of interpretation about such ideas.

I'll forgive it, though, because those who read this blog know that Steve is a programmer, and are likely programmers themselves. As such, the paradigm shift can be viewed as a substitute for a more succinct conclusion concerning the topic at hand.

Personally, though, I just liked the story when I thought its focus was the lunacy of airport "security."

What you've not noticed is that because of weak typing some of the existing caterpillar are in fact caterpillars. There are a few elephants too, a maternally enraged gorilla, a dachsund named Colin and a Queen Anne table.

Unfortunately not all of them are able to agree to step aside. Particularly the gorilla which has a distinctly belligerent side.

So, I understand that this is supposed to be a critique of type systems, but I'm not sure it works as written. In what way were the woman and her son incorrectly typed? Or is the point that Mr. T.S. couldn't handle authentication of various types? In any case, the (admittedly rather clever) solution doesn't involve type hacking at all.

Their "line pass" should be sufficient because it's from the right people and place, but it doesn't have the correct type. Maybe the LinePassFactory at the counter jammed, or whatever, but their just aren't any more of the objects.

One of the underlying problems is that the guard expects a type (LinePass) which is tied to an implementation (LinePass) which is not always available. It probably could have been fixed by supporting an ILinePass interface with a generalized authentication model, rather than just a LinePass class, so that you could have an EmergencyLinePass class (Factory) for such situations. But you would have to think of the LinePassFactory jamming to get that to happen.

Of course, if you ask me, that makes the situation more ridiculous, not less.

I'd have thought the allegory referred to single threaded transaction servers (TS) which processes two queues FIFO (ordinary queue and priority queue).

The priority queue was not designed for this special case. As the TS code is proprietary and could not be changed, the only other way to get around the problem is to hack the ordinary queue instead so that the urgent case could pass through.

Type safety kicked in here when it turns out that ordinary passengers couldn't be provided with a priority credential. The TS was probably sending people based on their credentials (type) instead of a priority. There were no bypass flags supplied.

This metaphor could also be applied to Net Neutrality. Imagine T.S. is instead N.N., and Anushri is pleading for her husband's medical records to get to his surgeon. The people in line represent YouTube viewers, MMORPG players, etc.

I agree with Gary Bernhardt's interpretation of it being an allegory for type safety; however both the story and his comment were running through my head all night, so I've written Parabola Redux - a follow-on where T.S. has been replaced with D.T..

Actually although Anushri walked like a nice lady, and talked like a nice lady, she was in fact a Pakistani terroist. She had been taught that security queue overflow exploit at the terroist training camp she attended last summer, along with a way to get into the back door of the cockpit. The plane crashed somewhere over Ohio.

The programmer references were good.. I was more impressed with the easy flow of the narrative... I never thought I'd make it through the long article (judging from the size of my scroll-bar handle!) but it was hard to hit the back button!

Java's type system is based on the OO concept that you are trying to model real-world things, so things have precedence over actions. Now push the metaphor back the other way.

Instead of trying to make a programming language mimic real life, examine how real life would look if it worked like Java. If you find yourself frustrated, pissed off, and thinking, "Man, that just makes no sense," you'll see how Steve feels about Java, and static type systems in general.

This is incredibly well written. We really need more people who can write like this in our industry. Wish I were one of them.

However, assuming the author is arguing against type safety, I think it would had been much more effective if he had not used the airport security line for the metaphor. You see, I think T.S. did absolutely the right thing. Both metaphorically and literally. Who's to say Anushri is not a terrorist? She sounds convincing, but I see nothing of substance... a handwritten note? a sad story? Ok, the child does lend some credibility, but considering the stakes, I still say, no dice.

Like computer systems, airport security personnel really should not be making judgment calls based on heuristics. Especially when the stakes are high.

Maybe the argument is subtly _for_ type safety?

Maybe I missed the point. I'm new to this whole anti-typesafety concept. Please feel free to enlighten me.

Sorry, Matt, but you just tweaked one of my pet peaves. If this comes off as excessive, please realize it's not all directed at you.

I'm really tired of the idea that any rules purporting to protect us are unquestionable. Most of what's happening in airport security is more show than susbstance.

In this specific example, the woman wasn't even asking to bypass a security check, just to bypass the line at the security check.

Are we really such slaves to our fear that we aren't willing to make exceptions for exceptional circumstances? Is any behavior or policy in the name of safety now acceptable, even if it is neither reasonable nor effective?

[pant pant pant ...]

Back on topic, that was definitely intended to be against type safety. The supposed benefit of type safety is that it ensures your input will match the conditions you're anticipated. The down side is that sometimes there really is input you need to handle for a condition you didn't anticipate.

This post was a really good example of how people routinely hack around these constraints, like Gary Bernhardt said above.

Thanks for the comment. I was referred to this article by a friend and really want to understand this position.

This statement from your comment preplexes me: sometimes there really is input you need to handle for a condition you didn't anticipate.

I don't see how software could possibly attempt to handle anything it did not anticipate, except to gracefully fail, which T.S. did. It would seem you would need to make some basic assumptions about an object or information you were presented with and these assumptions could be embedded in to a type hierarchy(the rulebook ).

Tying it back to the allegory, I guess where I struggle is with the implied need for a more benevolent and empathetic gatekeeper that can be flexible to any situation and do the right thing. I could be convinced this is important (and maybe even possible) for human interactions, but I don’t get how a computer can implement this in software. Anushri successfully won the crowd over by revealing some extreme circumstances. However she was only successful because they had context in their own internal “rule book” that allowed Anushri to communicate her needs to them. What if they did not know what a husband was? What if no one spoke English?

I’m really not trying to be ridiculous. I bring up these points just to demonstrate that I see most interchanges as needing shared context. Without that shared context, we don’t communicate. It doesn’t matter if we are humans or software. In software it seems to simplify things immensely if that shared context is explicit in the interface vs. implicit in the code behind the interface.

So I guess I would ask, how does a loosely typed software system use data that it did not anticipate to make decisions?

Note: I really feel like I might be missing the point of this, so if anyone wants to redirect this to what I really should be understanding from this post, please do so.

Matt, the closest I can come to an explanation is to ask what type do you use for input variables to a polymorphic function?

I've worked exclusively with loosely-typed languages. All the code I've looked at that had to deal with explicit casts looks nasty to me. But as with anything else, you have to really know something to really hate it. Someone else can probably give much better examples than I can.

Metaphors can be made to go either way. Its really not about having rules - its about defining the right rules with the right flexibility.

p.s. I concur with Ian, Christian and Matt on their comments. I was enjoying the story until it turned into a programming metaphor. You'll appreciate rules and their rigid enforcement if you ever drive/stand-in-line in India. This metaphor could also have resulted in a woman that fooled security.

I just wrote a little blog post on "why dynamic typing is useful", inspired by Matt & friends. For those who haven't had much exposure to dynamic typing, it might help to tie the ideas in the story to static vs. dynamic typing.

great stuff, totally surprised me with the programmer references toward the end (should I have expected anything else?), but...she should have written a quick security shim using a facade pattern, exploited the java container with out-of-bounds exception and a pointer to her own security key. But maybe I simplify....davethe C++ team

Andrew, any Passenger can actually be Terrorist as Terrorist is just a subclass from Passenger who has overridden the method "sitOnPlane" and super calls that function, but once in the air it calls it own private method "pushRedButton".Dave, creating a facade is good when you know all situations, but you can't always foresee everything. Say a car without wheels is developed. it will normally fit into any old parking lot, what you're saying is rewrite parking lot to change something that could perfectly fit the new situation without changes if only the guard wasn't so stubborn. I personally would just want another guard.

I'm looking forward to steve's "Salmon on the Mound"... blessed are the geeks for they shall inherit multiply...

I find the endless debates about language features to be rather silly. They all have their advantages and disadvantages. If you have a choice of language for a project, you choose the one best-suited to what you're working on. If you don't have a choice, you work around the disadvantages. Polymorphism and loosely-coupled challenge/response interactions could allow for bypassing existing checks, or otherwise delegating functionality that allows a system the flexibility needed to handle situations for which it was not originally designed. I'd love to see a parallel universe recitation of this story showing how it would work "better"

--- kathy said...Say a car without wheels is developed. it will normally fit into any old parking lot, what you're saying is rewrite parking lot to change something that could perfectly fit the new situation without changes if only the guard wasn't so stubborn. I personally would just want another guard.---

I would fire the one who made up the rules for this guard. Correctly done, it would accept any vehicle with the right dimensions. A vehicle, so I know it has the need to park and be able to move to the lot. And the right dimensions so I know it would actually fit in it.

The only things I can see go wrong can only be handled by the rules maker, not the language afaik. Then I think about limos requesting 2 parking lots, conspiracy lovers who don't want to tell their dimensions, etc.

About Parabola, the problem here is not: "Is this person allowed to pass?", but: "Who can go next towards security check?". Anushri is not allowed in the priority queue, because the queue, managed by T.S., does not recognize the reason as valid.

If the machine is broken (or ran out of passes), it's not the fault of T.S. T.S. requires some form of defined pass.

now what happens next, is that the priority queue declines continuesly. And this passenger keeps looping, begging and trying anyway.At some point the other passengers notice the requests for the priority queue gets declined continually. At that moment they check the priority reason of this unlucky passenger and decide themselves to step aside. Also the loop of the unlucky gets altered to this:while (!insidePriorityQueue && !insideNormalQueue) { BegSome() PriorityQueue.acceptMePlease()

if(normalQueueIsEmpty) NormalQueue.enter();}

For me this story is not about static/dynamic typing.It's about static/dynamic logic. And as of yet there's no snake nor gem that does that.

It wouldn't. You could also park a string in the parking lot, or an integer. Or a flying spaghetti monster.

@original post:

Why, in the name of all that is holy, should we solve this problem by changing the implementation of the Guard? If the guard would have been designed correctly to begin with, altering its behavior would not be an issue -- static or dynamic typing aside. Software should be designed to limit the impact of changing requirements. The last thing that I want to do is to have to hack up existing source when changes occur. That's one sure fire way to creating a Big Ball of Mud.

The REAL problem is that the interface that a given software component exposes should match the absolute minimum required for its implementation. Consider C#, for example... if you have a method that accepts a List<T> as a parameter, but all you're doing internally is iterating through it and visiting each member in some way, your method your really accept an IEnumerable<T>. Accepting a generic object as a parameter does NOT improve the design, because I could pass in a string, or an integer, or a FooBarBaz and my method would fail at runtime. Isn't it better to indicate what the method expects at design time?

Design is a result of the developer, not the language or the compiler.

You don't always have control over everything in the design, sometime you're bound by library modules that needs a specific class. But if you're bound by single inheritance you need to hack your way into the library module and that creates nasty code. dynamic typing does not have this problem, but on the other hand it's easier to build messy code with dynamic typing.It's mostly personal preference. But sometimes you just want to be able turn TS off for a while, specially when it keeps the code clearer and the programmer knows what he's doing. Too bad that when you can do it, it will be abused. It would be a neat feature.