Pagine

lunedì 20 agosto 2007

Parnas on abstractions

Communications of the ACM, June 2007, p.7

"Use the Simplest Model, But Not Too Simple

Jeff Kramer's view, expressed in his article "Is Abstraction the Key to Computing?" (Apr. 2007), that abstraction is indeed a key concept in computing, especially in software design, is correct but far from new. It's a lesson I learned from the late E.W. Dijkstra 40 years ago and underlies every software development method proposed since then. Dijkstra said many useful things. Among them is the most useful definition of "abstraction" I know: "An abstraction is one thing that represents several real things equally well." This positive definition is more useful than the more typical ones Kramer quoted that emphasize the elimination of information. Dijkstra's clarifies what must remain.

Dijkstra's definition allows us to distinguish between an abstraction and a lie. When a model makes assumptions that are not true of a real object (such as infinite memory), these assumptions are often defended by saying "It is an abstraction." Using Dijkstra's definition, such models are not abstractions. Rather than represent several things equally well, they represent nothing at all. Because they embody unrealistic assumptions, one cannot trust the conclusions that might be drawn from them.

Models that are not abstractions in Dijkstra's sense may provide insight or understanding but can also mislead. Programs based on them may not work, and theories based on them may yield results not relevant in the real world.

Dijkstra's work showed that two distinct skills are related to abstractions:

  • Being able to work with a given abstraction; and
  • Being able to develop a useful abstraction.
Mathematics courses teach us how to work with abstractions but not usually how to develop appropriate ones. Many researchers I know can analyze formal models, deriving properties and proving theorems, but do not seem to notice (or care) when a model is based on an impractical design or makes assumptions that are not true in reality. Both skills are important, but teaching the second is much more difficult and is the essence of design.

Many computer science courses fail to teach students how to develop abstractions because they use models that are not abstractions but lies. Students must be taught the implications of an idea often attributed to Albert Einstein: "Everything should be as simple as possible but not simpler." Finding the simplest model that is not a lie is the key to better software design."

David Lorge Parnas
Limerick, Ireland