Esoteric Dissertations from a One-Track Mind

May 31, 2007

Socialization of Medicine

Filed under: politics — codesmithy @ 6:20 am

From the arguments I used for the Fire Fighters, it is the natural conclusion that I would also be for the socialization of medicine. Not because of any intrinsic charity on my part, but rather because our medical system refuses to deny services to those unable to pay (unlike the Fire Department in Gilbert, Arizona) in many cases.

In short, those that don’t pay for medical benefits are able to receive them at the cost of those that do. Some people blame the insurance companies, medical equipment companies, the doctors, etc. That is not the way I see it. Medical costs sky rocket because, in effect, we are paying for emergency care for the poor. It taxes the system in such a way that hospitals have to shift costs of those that won’t pay on to those that can pay. It is a rather precarious situation to be in since as costs rise, the number of people that are able to pay decreases, meaning an ever increasing burden is placed on those “doing the right thing.”

Another part of the problem is the legal system, the potential of huge cash settlements in medical malpractice sets up an incentive for lawyers (so called Ambulance Chasers) to aggressively pursue legal action. Juries or judges typically find sympathy for apparent victims, resulting in large cash rewards, even it the doctor provided the best medical care to his/her ability. That cost is eventually passed on to other patients of the hospital. Note, I’m not saying that all malpractice is baseless, rather the system is weighted towards the victims.

Another aspect of it is drug companies, who through successful legislation have been able to extend their rights and profits.

The government is the only one with the authority to ensure everyone pays, fixes the legal system, and can control drug costs.  This is because the government is directly responsible for the laws that are causing some of the symptoms in the first place.  Limiting malpractice pay-outs is a start, however, the concern is that we would be unable to adequately compensate those that were victims of gross negligence.  Instead, what I would suggest is a state elected panel of doctors and a set of federal guidelines that govern how much someone should receive for a given malpractice case (after guilt has been assigned).  It would be up to the panels discretion to pay more or less than the federal guidelines for a given case.  For those that argue about the loss of jobs or the increase in taxes, your point is moot, we already pay for the freeloaders.  The choices are to cut them off, or make sure everyone pays.  If you are for the cut off option, that is fine, but I just don’t think it could survive politically, especially media reports about poor people being denied medical care.   As a matter of social policy, we need to get the poor out of only seeking medical attention if it is an emergency and towards a health maintenance approach, where problems are cheaper to treat.  Unfortunately, that means socialization.

May 30, 2007

You Don’t Get What You Don’t Pay For

Filed under: culture — codesmithy @ 6:20 am

Fark ran this story about how the Gilbert Fire Department (AZ) let a home burn down because it didn’t have fire protection. Many people on Fark expressed the opinion that the FD should have helped out. They certainly had the tools to help take care of the blaze. But ultimately, the unincorporated island chose to opt-out of fire protection, and the owners chose not to pay the monthly fee to cover their home.

As a matter of social policy the Gilbert Fire Department is not obliged to protect those that don’t pay for their services anymore than a person is obliged to give change to a beggar. A Fire Department takes money to run, it has salary, equipment, and utility costs. Fire men aren’t paid every time there is a fire, the vast majority of time they are waiting around for a fire to happen. In the long run, a Fire Department would prefer a smaller monthly fee, for a steady rate of income, rather than bursts every time a fire broke out (since people have this nasty habit of wanting something to eat about every day, or hot water, or power, etc.), which is why the $10,000 the private company charges seems so exorbitant, but it is in all likelihood fair.

If the people on the county island had their way, there wouldn’t have been Fire Department to begin with. The fact that others were enlightened enough to see a need and willing to pay for it, and through their charity, chose to ensure your personal safety is a greater credit to FD’s moral rectitude than to the people on the county island. The fact that family was a victim of unfortunate circumstances does not give them any special sanction to demand sacrifices from others.

One of the few things that I agree with Ayn Rand about is that you can’t simply honor need. The arguments of a free-market of Arizona won. They had a choice of what services they wanted. This family made a bad decision. Constantly asking society to bail people out of bad decisions is ruinous, and worse than socialism. At least with socialism you ensure everyone pays, with this willful bad decision making, you make the infrastructure fall apart because they have to handle all the freeloaders. It taxes those who are doing the right thing at the expense of those that willfully don’t. That isn’t justice, that isn’t morality, it is stupidity and a society trying to destroy itself.

In short, it can’t go both ways. Either buck up and pay for some socialized services, or don’t. But, if those that willingly chose not to buy-in and end up getting screwed by it; they have absolutely no right complain nor demand help from others. Take some personal responsibility for your actions.

It is situations like these that makes me think that we’d be better off teaching children Aesop’s Fables (especially The Ant and The Grasshopper) than trying to indoctrinate them with Christianity.

As a side note, some people were upset about the “disrespectful” attitude the firemen showed when broke out the lawn chairs. There is a cognitive basis where we perceive the firemen as perpetrators because they did nothing and the family as victims. At least, that is how those that sympathize with the family see it. No matter what the firemen did, people would project some aspects of the “Myth of Pure Evil” on to them. I highly recommend “Evil: Inside Human Violence and Cruelty” By Roy F. Baumeister, Ph. D. It is extraordinarily insightful into how people twist stories in order to frame them between victims (the family) and perpetrators (the firemen) in this case. Basically, what to look out for and the questions you need to ask yourself to get to the truth of the matter anytime someone tries to play the victim card.

May 28, 2007

Memorial Day: Realpolitik Explainations for War

Filed under: politics — codesmithy @ 10:21 pm

Today is Memorial Day in the United States, so it is fitting that we at least consider why the men fight and die in the first place. First of all, I am of the view that war can be better understood by looking at geopolitical and economic factors rather than just the high ideals of lebensraum, a war to end all wars, freedom or democracy. These are generally called “realpolitik” explanations since it seeks to express politics based on practical and material factors rather than on theoretical or ethical objectives. I’m not saying that geopolitical and economic factors are ever the reason for a country going to war, but rather provides a reason for going to war that is more compelling and more predictive, in short provides a better explanation of events than what is usually officially stated.

It is hard to explain the number of deaths in Iraq, both by sanctions and the subsequent invasion, in terms of WMD’s, terrorist attacks, or the invasion of Kuwait. It isn’t as mystifying if we enter in some considerations from the geopolitical and economic sphere, namely that Iraq has the third largest proven oil reserve behind Iran and Saudi Arabia. Oil is essential to the American economy and military, most people just think about it in terms transportation. But, in fact, oil is an integral part of our food chain, which starts with corn. Oil provides the pesticides, the fertilizers, the machinery that makes the industrial food chain, based on corn, go. Corn is fed to the chickens, cows and is processed into many of the chemicals that are used to make food, from high-fructose corn syrup in soda to xanthan gum.

We are in the process of building 14 permanent military bases in Iraq. This should not be surprising since we still have 2 Army and 2 Air Force bases still in Kuwait (Camp Doha, Camp Udairi, Ahmed Al Jaber Air Base, and Ali Al Salem Air Base). If the U.S. is so interested in promoting democracy around the world, why did we help overthrow Mossadegh in Iran, Allende in Chile, or support military Juntas in El Salvador? If Iran was truly our enemy as evidenced by our support of Saddam in the Iran-Iraq war, then why did we deal with the Iranians during the “Iran-Contra Affair?” None of these can be explained based on ethical or theoretical objectives, but can be understood in terms pragmatism and material factors with noticeably little regard for the much of the death, and suffering caused by these policies in foreign lands.

I can’t help but be reminded of the elementary school teacher who told me that animals didn’t eat humans because we didn’t taste good. In light of that information, it was hard to explain the massive hunts that took place anytime a carnivore attacked a human being. The animal was invariably hunted down and killed. I mean, if humans tasted bad, wouldn’t the animal take a taste and realize we didn’t taste good? We wouldn’t have to worry about an animal attacking a human again after its initial bad experience. The more contradictions I found, it became more obvious that the teacher lied. Evidence of cannibalism and man eating lions in Africa support the idea that humans taste just fine. Humans are relatively easy kills, assuming they don’t have a weapon. Add easy kill to just fine tastiness and you have an animal that is probably going to keep on attacking humans which is why humans so mercilessly hunt down and kill animals that learn this forbidden knowledge.

Most of the time, teachers didn’t outright lie, it is more of misleading through omission. It is not enough to explain the brutal act of dropping nuclear bombs (the only two that we had) on Hiroshima and Nagasaki without considering the implications for Europe and to the Soviet Union. The Soviet Union wasn’t the reason, but rather a reason, with a vast multitude of factors up to and including the unconditional surrender of Japan. However, if we look at it in terms of just surrender in terms of the peace treaty, dropping the nuclear bomb didn’t change the final terms of surrender too much since the Emperor remained in power.  The misleading and misunderstanding starts with our earliest education and continues into our adult lives.

Much of the modern rhetoric for war owes to Woodrow Wilson, who was an intellectual who first used the arguments like making the world safe for democracy. I can’t help but wonder if much of the eventual bloodshed over Vietnam would have been avoided if Wilson would have met with Ho Chi Minh. But, realistically, it wouldn’t have been. Wilson demonstrably held the idea that self-determination apparently doesn’t apply if you are not of European descent, under French colonial rule, and happen to be a communist. This is against the backdrop of United States, where films like “Birth of Nation” praised the Klu Klux Klan and the U.S. was in the midst of building its own fledgling empire.

That is to say, the arguments for an idealistic or ethical policy for war have always been off from the true motivations. If the Spanish-American war was to free people from the tyranny of Spanish rule, then why did we have to fight the Philippine-American War? As Mark Twain put it:

There is the case of the Philippines. I have tried hard, and yet I cannot for the life of me comprehend how we got into that mess. Perhaps we could not have avoided it — perhaps it was inevitable that we should come to be fighting the natives of those islands — but I cannot understand it, and have never been able to get at the bottom of the origin of our antagonism to the natives. I thought we should act as their protector — not try to get them under our heel. We were to relieve them from Spanish tyranny to enable them to set up a government of their own, and we were to stand by and see that it got a fair trial. It was not to be a government according to our ideas, but a government that represented the feeling of the majority of the Filipinos, a government according to Filipino ideas. That would have been a worthy mission for the United States. But now — why, we have got into a mess, a quagmire from which each fresh step renders the difficulty of extrication immensely greater. I’m sure I wish I could see what we were getting out of it, and all it means to us as a nation.

I can’t help but but struck by the similarities between the situation we face now in Iraq and the conflict in Twain’s time.  We face many of the same contradictions if we hold America’s policies to just theoretical, ethical standards or stated purpose.  Taking in a pragmatic or materialistic view, we can come to more meaningful views of the motivations involved.  That isn’t to say that war is always unjustified.  I think that there are wars in our history that were justified, such as the Revolutionary War, the Civil War, World War 2, and the initial Gulf War.  But, we can not deny some of the “realpolitik” motivations for each of these actions or discount them.

I wish the “realpolitik” motivations were more on the table.  So a democracy can do a more honest accounting of the cost versus benefits of remaining an oil based economy, I think it will start looking a lot more expensive than $3.50 per gallon at the gas station.  The reason the arguments are so contentious is because half the information is hidden, that it is hard to agree on an acceptable starting point.  This is intentional.  On the “realpolitik” stage, might may make right, but it doesn’t save you from an occasional sucker-punk.

Hopefully, this information helps to more honestly answer the question of why men and women die in the service of the government of the United States of America.

The New World and the Rise of Mormonism

Filed under: politics, religion — codesmithy @ 4:26 am

The European discovery of the New World had an influence on the social structures not the least of which was the church.  Roman Catholicism taught that the unbaptized went to hell.  Now, it is true that they could have occupied the region with the virtuous pagans, but with the arrival of Jesus, people were now saved, free to get into heaven in only they accepted Jesus as their savior.  Others that did not follow Christianity in Africa, Asia, or the Middle East could be looked upon as rejecting Jesus as their savior, and hence it wasn’t especially problematic if they spent an eternity in damnation.

When the discovery was made that there were millions of people living on new massive continents half the world away, this new evidence served as a shock to Christianity.  How could the church account for hundreds of thousands of people suffering damnation when they obviously were not given a chance to be saved?  Europeans may not have known of the existence of these continents before Europeans accidentally ran into them seeking  a path West to the Indies, but certainly God knew about the people living there.

There was no satisfactory existing explanation.  To resolve this dilemma, a new revelation was required.  Certainly, the church could conjecture based off of existing dogmas, but they could not offer religious certainty, discovering new continents certainly is an exceptional event.  The new revelation was provided by Joseph Smith, and thus the founding of the “Latter Day Saint” movement.  Joseph Smith preached that after Jesus’s death, he came to speak to the Native Americans of the New World before entering heaven.  Thus the great seeming injustice had been solved.

This is one of many examples of how changes in world view cause schisms in existing orthodoxy.  The effects of these schisms exist to this day.  Science causes its own schisms in the church around the literal creationists and those that feel that Genesis is more of a allegory.  Any new discovery leads to social impacts, the more conservative the institution, the more radical the discovery, the more chaos it must endure in the wake.  Thus, the most robust and enduring social institutions must be based on liberalism and freedom, which helps explain why much of this classical liberalism is at the heart of the United States of America’s social institutions.  Theocracy is then inherently unstable and necessarily oppressive in the act of its self-preservation.

May 27, 2007

Reflections for Memorial Day and One of History’s Lessons

Filed under: politics, random — codesmithy @ 5:04 am

On Memorial Day, Americans are supposed to reflect on the brave men and women who gave their lives in the service of this country. It is hard for me to fathom some of inhuman suffering some of them must have been put through. I’m in a debt of gratitude to all those who served with honor in armed services, past and present. I can’t imagine the loss that those families went through when their loved ones died. In that sense, I am, as an American citizen, obliged to ensure that when we do exercise the use of force, we do it for the values and reasons that we hold dear: the safety and security of the American people and for their freedom and liberty.

In that regard, we have a long way to go. As Major General Smedley D. Butler, United States Marine Corp so elegantly put it, “War is a racket. It always has been.”  In that light, we might think that the majority of people who agree with sentiments like Butler’s are the highly educated, high minded intellectuals (doves) and those who disagree are the go get ’em, patriots (hawks) that never made it to college.

That is, if you asked people to guess percentages of doves vs. hawks for Vietnam war in 1971 based on education, you’d probably get something like this (assuming you knew that the total adult population was 73% in favor of U.S. troops withdrawal and 27% were against).

College Education High School Education Grade School Education Total Adults
For Withdrawal (doves) 90% 75% 60% 73%
Against Withdrawal (hawks) 10% 25% 40% 27%

The actual breakdown is this:

College Education High School Education Grade School Education Total Adults
For Withdrawal (doves) 60% 75% 80% 73%
Against Withdrawal (hawks) 40% 25% 20% 27%

If a person was college educated he/she was twice as likely to be a hawk as opposed to a person who only had a grade school education. (Lies My Teacher Told Me by James W. Loewen pg. 304-5).  In that vein, it should not be surprising that our congress and executive branches are usually one of the last institutions to realize what a mistake it was to go to war in the first place.

I believe the reason for this trend is because history talks too much of the great military victories and ideals and not enough of great suffering that was caused.  So, college educated people tend to overestimate what can be achieved by going to war, and tend to underestimate the costs.  Social inequities also change the cost/benefit calculus.  The enlisted members of the military tend to come from poor backgrounds.  Even when the draft is put in place, there are usually recourses for the well off members of society, some as blatant as being able to opt-out by paying a fee, to joining the national guard.

This country has engaged in many military actions.  Some, if you mentioned them to most Americans, would likely be met with surprise.  In that respect, the greatest homage to Memorial Day that we can pay as Americans is to ensure that lives are not sacrificed in the name of our freedoms needlessly.

May 26, 2007

Cause and Effect

Filed under: culture — codesmithy @ 8:04 am

Cause and effect is a useful rubric for understanding many phenomenon. Because it is so useful, and can be applied to many situations, people can fall into the trap of trying to classify everything as a cause or an effect of something. In many ways, it is clear that this is patently false, with the famous quip: “What came first? The chicken or the egg?” In actuality, the answer is neither. Current scientific understanding states that the chicken evolved from simpler organisms through the path of survival of the fittest based on history of ancestors, competitors and chance.

Clearly there is a another problem with “first cause.” Since, we can always regress a cause one step further (every effect has a cause, every cause is an effect of another cause). Some people insert the base condition of “God,” as the answer of a cause that needs no other causes. This is underhanded and disingenuous. Not that they want to call the base condition “God,” per-se but because of all the other laughable traits that they want to ascribe to it. It would be like me trying to say that I wanted to call the base case a “quezantarticle.” And by the way “quezantarticle” is blue, tastes like a donut, and has magical properties.  It sidetracks the debate and attempts to add legitimacy to a deeply held cultural fairy tale, which has no place in rational discussion.

It could be that there was ample evidence in the universe to explain exactly how the “Big Bang” (the first cause of the universe) came about, so it wouldn’t seem so mysterious to us now, but much of the obvious evidence has vanished just like determining cosmological constants will be harder in millions or billions of years from now.  That isn’t to say that we won’t learn the nature of the beginning of the universe, but gaps in our current understanding shouldn’t be used as a buttresses of irrationality, since it might be genuinely hard and take some ingenious reasoning to get to the truth of the matter.

That said, “every effect has a cause” is a logical contradiction.  It is a flaw in our thinking, not with nature.  We have to accept the fact that there are effects without causes.  In many cases, the causes are so diffuse that to even say that they contributed is to come to a completely absurd conclusion.  A butterfly flapping its wings did not “cause” a hurricane off the coast of Florida.  Such a view of the world constantly pushing up vast and intricate sequences of dominoes to be pushed over at the slightest disturbance is nothing more than hubris, conspiracy, and delusion (what caused the butterfly to flap its wings?).

The world is the way it is.  Cause and effect is a system that we try to impose to understand it better.  But, in the end, symbiosis, positive feedback and co-evolution truly blur the line between what is a cause and what is an effect.  Social systems and nature abound with such networks and ecosystems.  We should apply cause and effect when we can, but we also need to be aware of its limitation or else we will fall victim of missing all the small little things that make any system actually work, and too arrogant in our understanding of complex systems.

May 25, 2007

Marie Antoinette and “Let Them Eat Cake”

Filed under: random — codesmithy @ 5:54 am

One of thing that has been sort of a thorn in my brain for a number of years is the meaning of “let them eat cake” which was supposedly uttered by Marie Antoinette, Queen of France. For starters, I don’t really care if she said it or not, which is an annoyance wading through various resources on-line since they tend to devote quite a bit to that particular topic. Al Gore didn’t claim to “invent” the Internet either. But, many people had a perception of him as a person, that he exaggerated, made audacious statements and took credit for other people’s accomplishments, which the statement seems to embody. The fact that he didn’t actually say it may make it tragic and unfair, but it doesn’t change does not change the fact that many people (possibly mistakenly) had the perception of him as an exaggerator.

The same goes for Marie Antoinette, she was executed after all, but was it because they perceived her as crass and uncaring or hopelessly out of touch? It was given that she was living an opulent and luxurious lifestyle. But that doesn’t help choose one interpretation over the other. Part of the confusion comes down to what “cake” means. “Cake,” in the sense that I usually have heard it used, is reserved for special occasions, and desert. I would expect it to be more expensive then regular bread since it takes sugar to make it. However, it still isn’t clear what the phrase meant. People are starving. The Queen knows that they are, they have no bread, she says, “let them eat cake.” Where would they get cake from if they had no bread? Was she planning on giving them cake from one of her parties? This sounds more naive than crass, but it didn’t seem to make a lot of sense, since she apparently said it jokingly, and I guess I didn’t get the joke.

But as my junior high history pointed out, there are other definitions of cake. From looking through various definitions at Yes, my definition is near the top of the list: “a sweet, baked, breadlike food, made with or without shortening, and usually containing flour, sugar, baking powder or soda, eggs, and liquid flavoring.” But, it also means “a flat, thin mass of bread, esp. unleavened bread,” which from what I recall from his lecture, was what he thought Marie meant. It certainly makes more sense. You could see Marie saying “Oh you don’t have bread, well we have this cheaper stuff, “cake” that you can eat, ha ha ha, let me get back to my seven course meal.” Hence, she was crass and uncaring. All the pieces seem to fit.

But there are many definitions to choose from, how do we know the cake as cheap bread is correct? Well, what did the quote in French have her as saying? “S’ils n’ont plus de pain, qu’ils mangent de la brioche,” where brioche is “cake.”  What food do the French call brioche in the 18th century.  According to wikipedia, brioche is “is a highly enriched French bread, whose high egg and butter content give it a rich and tender crumb.”  This seems to blow the cake as “cheap” bread out of the water, since this bread sounds more expensive rather than less expensive than your typical bread.

Which leads us more firmly, back to the original interpretation: cake as a more expensive form of bread.  However, we still have to reconcile that joking part of it.  The way to fit the pieces together is to put the phrase in this context.  Oh, they don’t have bread, well they’ll just have to pony up and buy the more expensive kind.  Which would be easy for her to do, but unrealistic for the starving poor.  This quote is meant to paint her as crass and uncaring, not naive in the typical interpretation of it.

May 24, 2007

Hate Crime Laws: Do We Need Them?

Filed under: politics — codesmithy @ 5:26 am

There is a common assertion that a crime is a crime? Why does it matter what the motive of crime was, justice should be blind, or at least color blind.

At an earlier point in my life I agreed, but I’ve come to a different conclusion since then. Hate crimes are necessary because we don’t live in an equal society. Minorities are discriminated against. To throw out the vast history and experience and act like today is a new day, a Monday morning, where all past sins are forgiven and forgotten is to be blind of reality and history.

Since much of modern controversy surrounds black and white relations, I will be primarily concerned with this history as opposed to gay, Jewish, or Latino/a. The immediate history of our modern situation is the civil rights movement and the Nadir of American race relations (warning: graphic) that came about “19th century and the beginning of the 20th.” We had a situation in the United States where black people were being lynched (warning: graphic) openly.

When you look at the photos, particularly the last one, get past the grotesque wonder of the spectacle and start asking questions. Such as, why are there people around? Usually killers hide a body, these are out in the open with lots of people around. The couple, where the boy is grinning holding the girl’s thumb, are they on a date? Why are there women around at all? Then there are the two black men hanging from the tree, what type of hell did they go through before they met their end?

The simple fact of the matter is that white people had a confidence that they wouldn’t be convicted of the crime of killing a black man, no matter how much evidence was placed before the jury. This could be because law enforcement had ties to the KKK in many instances that made for weak evidence collection to the fact that it only takes one stubborn person on the jury to cause a mistrial. Justice and injustice worked one way, for whites against blacks. As much as we’d like to think we have progressed, the reality is that for many, the day to day realities have remained unchanged.

Hate crimes seek to harness the fear of the very real and vast injustice of the past. We owe it to the victims of crimes that went unpunished in the past that their memory isn’t a tool of fear in the present. A hate crime to me is not one on a white man against a black man. It is a white man against a black man invoking unpunished crimes of the past to instill fear in a whole community. Yes, it generally works one way. The vast multitude of injustice went one way also. It is one thing to have not punished those crimes in the past. It is quite another to allow someone to profit from it currently. The hope of the criminal to additionally profit cannot be ignored in their punishment.

May 23, 2007

The Omnivore’s Dilemma and Mad Cow

Filed under: books — codesmithy @ 5:32 am

I just finished reading “The Omnivore’s Dilemma: A Natural History of Four Meals” by Michael Pollan. I thoroughly enjoyed it. I don’t know quite how to describe it, but reading the book felt like a long dinner, such that I felt like I should have been drinking some red wine as I read. The book itself attempts to trace the origins of four different meals: McDonald’s, Whole Foods, Farmer’s Market (local), then by actually hunting and gathering food from Northern California.

The McDonald’s meal is a representative of the industrial food chain, which is also the domain that Mad Cow affects. The industrial food chain is actually better described in “Fast Food Nation” by Eric Schlosser, who not surprisingly shows up giving praise on the back cover of “The Omnivore’s Dilemma.” The same basic picture is described in both books.

What concerned me was this post I found on digg.

Now its WIFI
before that it was phones
before that bird flu
before that SARS
before that mad cow disease
before that Aids.. — m73a

While, I dislike the way, for lack of a better term, “the media” trumps up things that are going to kill you. Mad Cow was probably too sensationalized, but it is a serious problem, coming from an unlikely source.

Mad Cow comes about from cows eating cows, which is especially surprising since cows are herbivores. But, none the less, cows are put into rather unnatural conditions in feed lots where they are fattened up before they are slaughtered. The “solution” to this problem was to ensure that cows were not fed cow remains. In that cow remains can be fed to chickens and vice-versa but no cow remains are supposed to be fed to cows for meat of human consumption. Now, whether that will completely stop prion transmission is questionable. The other odd thing about feed lots is that they tend to feed the cows corn, which isn’t something a cow would naturally eat either. This turns the cows stomach, which is naturally neutral, acidic (like human stomachs). This is breeding new strains of bacteria such as E. coli O157:H7 that can turn around and infect humans. The cows themselves are generally not well when they go into the slaughterhouse, they are generally kept going mostly by antibiotics.

The industrial food chain is more industry than nature. Ultimately, the products of this food chain become, quite literally, part of us. Mad Cow is not necessarily the cause of a calamity. Rather, it is a warning sign, a harbinger if you will. It foretells of meaner bugs that will be a tad too aggressive for their own good. If you think the human race has fundamentally changed since Upton Sinclair wrote “The Jungle,” I don’t agree with you. The same perils exist, for the same reasons.

May 22, 2007

Sudoku Solver, Part 2

Filed under: programming — codesmithy @ 5:59 am

The one design philosophy embodied in the sudoku solver is “Design for Testability.” According to a study by DeMarco and Lister, professional programmers average 1.2 bugs for every 200 lines of code. Now, the smallest block of code that you can test via a computer is a function. There are ways to test smaller blocks of code manually via a debugger, by manually setting variables and skipping instructions, but since testing is something we’d like the computer to help us with if possible, it is important to have testable functions. Since the program was 277 lines, as it turns out, I did introduce a bug when writing it that required debugging.

The most significant artifact of the “Design for Testablility” are the following function prototypes
bool IsCorrect(void) const;
bool CheckRow(int i) const;
bool CheckColumn(int i) const;
bool CheckSquare(int i) const;

IsCorrect would be a large function without CheckRow, CheckColumn, and CheckSquare. Notice, that each function produces a meaningful result that can be interpreted.  If we have a problem with a column, then we only need to set that one column, instead of all 81 entries of the Sudoku board.  As it turns out, there was a bug in the IsCorrect logic. When I first entered a sudoku puzzle, none of the squares were correct. This narrowed the bug down to IsCorrect or CheckSquare. So, I wrote a test for CheckSquare, figuring that was most likely where the bug would be found.

void Test(void)
Sudoku s;
bool result = s.CheckSquare(0);

After, exposing the CheckSquare function as public. Interestingly enough, when I ran the test, the function didn’t assert. When I looked harder at my IsCorrect function I found the error.

// Check Squares
for(int i = 0; result && i < DIMENSION; ++i)
result = CheckColumn(i);

Oops, that should be CheckSquare(i). After I fixed that problem, the program gave the correct solution.

I feel that there is an attitude in academic Computer Science that programs are like equations, in that view the proper way to ensure quality is by rigor and errors can be avoided. In my opinion, bugs cannot be avoided, they happen, and the best thing that you can do plan for when they do occur, that you’ve given some thought on how you can track them down quickly. If you write a function that is over 200 lines, it is almost certain that it has a bug, and that it exists anywhere in the 200 lines of code. Functions that are less than 20 lines are likely to be 95% bug free.  Being able to track the bug down to 1 or 2 functions, culling 80% of the code automatically, as we did here, was invaluable to quickly getting the program done and working.

Older Posts »

Create a free website or blog at