Coding and Precision in Language and Meaning
An infant cries and you don’t know whether it is hungry or has tummy trouble. If you give it milk, it stops crying. As it grows, the request
Me Milk! and later
Please give me some milk to drink. Children learn as they grow and their language acquires more precise meaning. Similarly, as the software grows, the tests acquire more precise meaning.
Proposition in logic is a statement that expresses a concept that can be either true or false. For instance, we can make valid propositions about the concept of grass:
• Grass is green.
• Grass is a plant.
• Grass grows.
• Grass is a monocot.
And so on lead to increasing meaning and precision of meaning for the concept of grass. We can express this as specifications in code similar to the sheep example as shown below:
describe Grass it 'is green' it 'is a plant' it 'grows' it 'is a monocot' end
Now consider the following:
• It has a wide opening to water tank
• It has a marked tank for exact water filling
• It has two-hour auto shut off
• It has filter basket
• It has a thermal carafe
• It is usually in the kitchen
• It has a sink
• It maintains the temperature of the drink inside
What is it? At some point in the sequence you connected with the pattern and understood it was a description of a coffee maker. From that point, each statement confirmed your understanding. We can express these statements as specifications in code that describes the coffee maker. This is discussed in more detail in my book Test Driven Development in Ruby published by Apress. Subscribe to my newsletter if you want to be notified about the discount coupon codes for the upcoming book.