BLOG@CACM
Computing Applications

What Is a Variable?

Posted
Robin K. Hill, University of Wyoming

What is a variable?–the name of a value. What is an attribute?–the name of a property. These are the working definitions that most of us find adequate in daily life and daily computer science. To consider whether there is more to it is to consider an ontology, the ontology of the variable. Is there a good comprehensive definition of "variable" for students and laypersons?

First, however, let's address the subject that arises prominently where variables meet worldly ontology—the professional design of an ontology for some real thing, in some domain, driven by a commercial need to capture some enterprise in a database. The question is, "What do we need to keep track of?"

To answer that question—there's money in it—requires extensive knowledge of some real-world arena of activity, such as sewing, or collateralized debt obligations, or military deployments, or Bordeaux wines [Noy and McGuiness], along with the skills to represent that knowledge in some data language. Working under the entity-relationship model, an expert would elicit and record the entities, attributes, and relationships that need to be exposed in the domain.

The principles of working ontology is a subject taken up by several philosophers of computing. The goal is often knowledge representation and sharing, and the objective is often organizational. Barry Smith and fellow researchers combine the abstract or formal with the domain-specific [Smith2004, Smith2008]. Basic Formal Ontology provides templates and tools as in engineering, and addresses philosophical questions arising from those practices [Buffalo Ontology].

That's not what we're talking about. The question of interest here—there's no money in it—requires probing into the nature of that workhorse abstraction, the variable. We look not to the fine-grained level of a "distinction that makes a difference" (attributed to Donald McKay [McKay]), but to the level of identifiers with associated values. Quine says that "to be is to be the value of a bounded variable," an intriguing notion, but not the informal explication we seek. We want to articulate—toward a comprehensive definition—the ontology of a variable as it is used in computer programming. We mutter, "What's the variable for the tax rate?" or "That variable has a misleading name" or "We don't need a variable for month, because that's a function of the date." The ontology of something that is used so relentlessly in computing must have something to tell us about computing.

Let's consider several questions that may provide direction. (In fact, questions are as far as we go here.)

  • If a variable is the name of a value, what about a constant? The distinction is easy to explain in programming, but not so easy outside of it. Is const a special case of var, where some extra property, "mutability," attaches to the var object? And what about the attribute of database design; what is that? Does attr break down into var and const? William Kent raised this question of the ontology of the attribute in 1978, noted its peskiness, and concluded that there is really no difference between an attribute and a relationship.[Kent]
  • What is the difference between a variable and a value? Is the variable a thing or some property of a thing? To say that we don't need a variable for the month is to say that the value (but not the variable) can be derived elsewhere. Because variables "go away" when values are substituted, a common view of a variable is as a "placeholder." What is it holding a place for? For a predicate? For a proposition? For an entity? In other words, what is the shape or category of a variable? Is it an attribute of something, a whole statement about something, or the something itself? Again, in a program (or in its formalization in denotational semantics), this is clear; the difference between variable and value is embedded firmly in the process.
  • What about the multiple instantiations, the fact that all occurrences of a variable are bound to the same value? To say "that variable has a misleading name" is to condemn several substrings of code. How would we include that aspect (also straightforward in a formal semantics) in a comprehensive definition?
  • Is a variable something we know or something we don't know? An algebraic definition of a variable is as an "unknown." Yet we know a lot about a variable x that appears in an equation such as f(x) = ax^2 + bx +c. We know that it is an object suitable for such a setting, that is, a number, and that it belongs right there, and that its value is constrained by the given relations to other values. What's unknown is which number. We always "know" the variable in the rather weak sense that we grasp its need and purpose. In a program, a variable's value is something that we don't know in the source code, the human product. In the execution, as soon as it's bound, the value is "known" in some sense, but to what or whom?

The art of definition has a philosophy of its own [SEP-Definition]. Experts in that realm would not be surprised to encounter difficulties, but computer scientists might be surprised at the subtle and complex issues that come from a mundane and familiar idea.

References

[Buffalo Ontology] Buffalo Ontology Site. University at Buffalo. Accessed 29 January 2019.

[Kent] Kent, William. 1978. Data and Reality. North-Holland Publishing Company. Chapter 5.0. Attributes.

[McKay] McKay, Donald. 1969. Information, Mechanism and Meaning. MIT Press.

[Noy and McGuiness] Natalya F. Noy and Deborah L. McGuinness. Undated. Ontology Development 101: A Guide to Creating Your First Ontology.

[SEP-Definition] Gupta, Anil. 2015. Definitions. The Stanford Encyclopedia of Philosophy. Edward N. Zalta, editor. Accessed 31 January 2019.

[Smith 2004] Smith, Barry. "Beyond concepts: ontology as reality representation." In Proceedings of the Third International Conference on Formal Ontology in Information Systems (FOIS 2004). Pgs. 73-84. IOS Press.

[Smith 2008] Smith, Barry. "Ontology (science)." Formal Ontology in Information Systems. C. Eschenbach and M. Grüninger, editors. Proceedings of the Fifth International Conference on Formal Ontology in Information Systems (FOIS 2008). Pgs. 21-35. IOS Press. DOI:10.3233/978-1-58603-923-3-21

 

Robin K. Hill is a lecturer in the Department of Computer Science and an affiliate of both the Department of Philosophy and Religious Studies and the Wyoming Institute for Humanities Research at the University of Wyoming. She has been a member of ACM since 1978.

Join the Discussion (0)

Become a Member or Sign In to Post a Comment

The Latest from CACM

Shape the Future of Computing

ACM encourages its members to take a direct hand in shaping the future of the association. There are more ways than ever to get involved.

Get Involved

Communications of the ACM (CACM) is now a fully Open Access publication.

By opening CACM to the world, we hope to increase engagement among the broader computer science community and encourage non-members to discover the rich resources ACM has to offer.

Learn More