2017-03-16

Logic Errors, Edge Conditions, and Politics

We software engineers spend a lot of time -- too much, we think, but usually too little -- trying to ferret out two things that make our programs blow up. Politicians should learn something from our experience.

Logic Errors

One of those program problems is logic errors. I can easily illustrate what that is. Suppose you're writing a program for a robot that is able to move around within a building. A small snippet of code might be something like this:

if( Doorway.Door.IsOpen ) {
    Doorway.Door.Open();
}
Doorway.Traverse();


Do you see the logic error? There's one, tiny thing missing: the word NOT. It makes no sense to open the door if it's already open. We want to open the door if it's closed. The program should look more like this:

if( NOT Doorway.Door.IsOpen ) {
    Doorway.Door.Open();
}
Doorway.Traverse();


That's what logic errors are all about. This is the easiest kind of program bug to find and fix. Most of the time, we fix them before our programs get out of the lab.

Edge Conditions

What's harder to fix is unhandled edge conditions.

Visualize all of the conditions that a program can encounter as a the surface of a two-dimensional sheet of paper. The vast bulk of these conditions are somewhere in the interior of the sheet, surrounded by other conditions. Those are the "usual" conditions, and they're what we write the program to handle. But the sheet has edges, conditions that weren't uppermost in our minds as we wrote the program.

If the robot in the first story inhabited a building in which the doors are mostly open, the programmer might forget that if block above. The program to handle doorways might be just this:

Doorway.Traverse();

But then the robot, trying to follow its simple-minded instructions in its simple-minded way is found with its "chest" against a door, stupidly pushing and pushing and pushing, but getting nowhere because the door is closed.

The closed door is an edge condition. Edge conditions are why if blocks appear in code. We put in at least one if block for every edge condition we can think of.

Politics

I'm guessing you probably aren't a software engineer. But maybe you're a voter. Maybe you're even a politician. If so, read on.

We software engineers write programs that tell dumb computers what to do and how to do it. Politicians do something very similar, but they're programming whole societies, not idiot computers. Yet their programs are often dumber than my worst effort. They make logic errors and they ignore edge conditions.

Here's just one example of a logic error: Writing a law to fix a problem that does not exist. Voter identification laws are in this category. There has never been enough documented voter fraud to justify these laws. Oh, yes, you can correctly say that we ought not to let people vote if they are not eligible to vote. Indeed! But how often do ineligible people attempt to vote? Where are your statistics? How do they justify the expense and effort of what these laws require? Mostly they don't. And I'm not even talking about the real purpose of the laws: preventing certain types of eligible voters from voting. These laws spend my tax dollars, trying to fix a problem that pretty much doesn't exist.

Then there are edge conditions. Let's think for a moment about the bathroom bills that are becoming so popular in some of the redder states, including here in Texas. They want to force people to use the public restroom that corresponds to the gender on their birth certificate. They think that this is a simple matter. Everybody is either male or female, right?  And birth certificates are never wrong, right?

Pathologist Gerald Callahan's book, Between XX and XY: Intersexuality and the Myth of Two Sexes, points out that more than 65,000 children are born every year without an obvious sex. The doctors who deliver them do not know whether they are boys or girls. Some children are born as apparent girls but naturally become boys at puberty. Some people don't have precisely two sex chromosomes in their cells -- they aren't XX or XY. Some are XXY or XXXY or XXXXY or only X. Which restroom should those folks use? Those people represent unhandled edge conditions in the societal program that we call "The Law".

And then there are the transgender people, the ones that are actually targeted by these laws. I have seen a photograph of a person who was born female and went through the sexual reassignment process. She/he bulked up and became the very image of a huge, imposing, menacing Black dude with tattoos. Imagine him/her obeying the law and using the ladies' room in a restaurant. Can you imagine police being called to deal with the Black man who has the nerve to enter the ladies' room? I can. Would you perhaps be more comfortable if he/she simply used the restroom that's more appropriate to his/her apparent gender? I would.  This person represents an edge condition that is not handled well by the proposed Texas bathroom bill -- yet she/he is the very target of that bill.

You might be tempted to conclude that the legislators who are in the process of enacting this bill are intentionally trying to crash the system. That's what it would look like if this law were a computer program.


2017-02-19

A Tale of Two Stories

A novel that I'm currently reading has a character who says*, "Narrative. Consumers don't buy products, so much as narratives". He explains that designers and marketers are taught to "invent characters, with narratives" and then create products, companies, etc. around those stories. One of my friends, a widely published Christian author and speaker, has a book titled The Story We Find Ourselves In.

Stories are important.

I want to tell you about the story I grew up in and contrast it with a different story that we are being force fed.

Story 1:

I grew up in the America of the 1950s and 1960s. America was The Good Guys. Our heroes wore the white hats in all the westerns. We lived by the rules, even when The Bad Guys cheated. And, as Dad explained, it's not true that might makes right. Rather, we were mighty because we were right.

In that America, we believed in freedom: freedom of thought, freedom of speech, freedom of religion, etc. We were a mostly Christian nation, but we all believed that every American had the right to practice any religion. We might hate the religion you chose, but we were ready to die for your right to choose it.

In that America, we respected each other, even if we did not like each other. We believed in every American's right to pursue a better life. Free public education was the norm, and it was of very high quality. State universities were affordable and anybody who could do the work could attain a college degree and a good job.

In that America, facts were thought to be important. Business and government leaders who ignored facts soon stopped being leaders.

Whatever your religious beliefs, it is difficult to deny that the roots of this story are ancient and buried deeply in biblical teachings of loving our neighbor as ourselves -- and everybody is our neighbor.

Story 2:

In recent years, a new story has become increasingly popular. Its roots, too, are ancient, but based in fear. This is mostly a story of fear and hatred: The world is a scary place, so we have no choice but to fear and hate anybody who is not like us.

Which us? Most of the people who peddle this story are white and claim to be Christian. We are told to fear anybody who is not white or not Christian.

And we're told that facts no longer matter. That's essential for Story 2, because it is so very easy to completely discredit it, if you believe facts.  Story 2 says that violent crime is at an all-time high. In fact, it has been diminishing for decades. Story 2 says that public education has failed us, and our children are not getting an education, so we must support other alternatives and starve the public schools into oblivion. In fact, standardized test scores tell a completely different story. Story 2 tells us that America is a "mess". In fact, as Donald Trump took the oath of office, nearly every economic and social indicator of national well-being had been improving for years. Story 2 says that Muslims are terrorists. In fact, most Muslims hate terrorism and most acts of terror in this country have been committed by white men who called themselves Christian.

During the painfully prolonged Presidential campaign, those of us who care about facts kept wondering when Trump would get specific about his policies and plans. He never did. Instead, he just kept feeding us his version of Story 2: Fear and hate foreigners, Muslims, and the press. But he's special. He can save us.

Trump fed us a story, and he continues to do so. Unlike most Presidents, he realizes that his true role is Storyteller-In-Chief. That realization explains why he doesn't bother with many of the things that other Presidents have done, things like reading the Presidential Daily Brief, or achieving a deep knowledge of international affairs, or agonizing over the details of a policy proposal. Instead, he jets off to his Florida White House and hosts a campaign rally from the steps of Air Force One. A campaign for what? Not for the presidency - he's already won that. This was a campaign for Story 2.

Which Story is True?

That's the wrong question. Both are demonstrably false. America never was The Good Guys who always played by the rules, and Trump's America is even more fictitious.

The correct question is, "Which story is it more profitable to believe in?"

My answer: Story 1.

Within Story 1, America became the preeminent nation in the world; and people of every race, color, and creed proved that this grand experiment could be a success, both for the nation and for every person who would commit to it. I, the son of a grocer who never finished college, became a military officer and later earned a doctorate. I have a satisfying and remunerative career as a software engineer.

But Story 2 would have us deny those opportunities to many of the people who have made America the great nation that it is.  Make America great again? It never stopped being great. The immigrants Trump wants to keep out are not clamoring to get here because we're an inferior country.

Let's Be Indivisible

I have recently joined a local Indivisible group, because I believe that we can return to Story 1.

I like that name, Indivisible. It so clearly evokes the Pledge of Allegiance, "… indivisible, with liberty and justice for all".

The Indivisible movement is not about Democrats against Republicans. It's about American citizens (hopefully both Democrats and Republicans) trying to uphold the America that is promised to us in the Constitution.

When I accepted my commission as a military officer, I swore to "support and defend the Constitution of the United States against all enemies, foreign and domestic". Our current President and his Story 2 agenda are enemies of that Constitution.

Years ago, I resigned my commission, but I never resigned the oath. That's why I joined Indivisible.

I'm in the fight.


____________________________________
*Zero History, by William Gibson, page 30.