Thursday, February 15, 2007

Ada and Strong typing

This blast from the past, Why Programming Languages Matter by Lt. Col. John A. Hamilton Jr., U.S. Military Academy helped me remember some of the reasons I decided to like strong typing, in my formative programming years.

This article is a quick read, and has some cool pie charts of languages used within the US Department of Defense.

The choice words, for me, are found in the section "Reliability Counts":


Make no mistake, war is about killing people and destroying things. Military weapons systems are designed to be lethal and must be reliably controlled. Unreliable military software is frightening. We often hear of Ada's strong typing. An implicit-type conversion that results in a one-degree rounding error will, at a range of 40 kilometers, put ordinance 700 meters off target. In a close combat situation, a 700-meter error can result in friendly casualties. Reliability is important.

Just a few thoughts:

1. Wow: 700 meters. That puts programming in a vivid perspective: "hmm, am I forgetting something that would put high explosives 700 meters off target?"

2. The words "must be reliably controlled" leapt off the page, it seems to me that programming is nothing if not about control.

3. This application area seems to be one of the cases where the bureaucracy and removing-trust-from-the-programmer is a healthy double-check. I do wonder if these high-reliability systems tend to have very clear requirements up front, which could encourage top-down design. I get the sense that typeless languages help you in situations where it's more OK to proceed into code without a fuzzy idea of what you're trying to accomplish, and a rigid type system would really slow you down. I don't suppose it's 100% true, but I wonder if in weapons systems you have less of a problem with feature creep than with, let's say, web applications where static typechecking is often absent (Perl, Python, Ruby, with Java a notable exception).

No comments: