What is Semantic Computing, and Why do we Need It?

What is Semantic Computing? In a nutshell:

  1. Semantic computing allows a program to perform computations based on type rather than relying on imperative methods operating on “meaningless” values.
  2. While the above is useful, the full power of semantic computing is revealed when used in conjunction with a publisher/subscriber mechanism and therefore, from my perspective, a pub/sub is an integral part of defining “what is” semantic computing.

I’ll use a simple refrigerator temperature sensor as an example (C# code).

A Non-Semantic Example

In a non-semantic implementation, we might have imperative code flow that looks like this:

public void SampleAndProcessTemperature()
  double fridgeTemp = TakeTemperature();
  if (fridgeTemp > 45)

There are several problems here:

  1. This implementation is monolithic — it’s behavior is fixed by the programmer.
  2. The temperature type, a double, is meaningless to the machine.  Meaning exists only in the human-produced code, and even that is limited and error prone.
  3. Digging deeper, the concept of temperature unit (is it Fahrenheit, Celsius, Kelvin, etc) is completely missing.

Even though somewhat contrived, this is how I see 99% of coding done today (including my own) and, in my opinion, is the core reason for why programs have bugs and limited lifetimes requiring complete rewrites every three to seven years.

A Semantic Example

public class DegreesF
  public double Value {get; set;}

public class FridgeTemp
  public DegreesF {get; set;}

public void SampleAndProcessTemperature()
  FridgeTemp temp = new FridgeTemp() 
    DegreesF = new DegreesF() 
        Value = TakeTemperature()

In the semantic example, the native type “double” is encapsulated in the semantic type DegreesF.  This allows the computer to meaningfully understand the native value and with little additional coding can provide conversions to other semantic types such a DegreesC or DegreesK. Also, the imperative function does one thing and one thing only — it publishes a semantic type.  Now, we can plug in subscribers of the semantic type:


These subscribers “listen” to specific semantic types and perform computations autonomously when that type is published.

A Costly Non-Semantic Failure

NASA lost a $125 million Mars orbiter because a Lockheed Martin engineering team used English units of measurement while the agency’s team used the more conventional metric system for a key spacecraft operation, according to a review finding released Thursday. If Lockheed Martin had used semantic types for the Mars probe software, the compiler would have reported the error in English vs. metric unit differences (source), or even better, would have provided automatic conversion.  Instead, $125 million of taxpayer money went, if not down the drain, then either into deep space or in the creation of crater on Mars.


Non-semantic programming is monolithic, non-extensible, and, lacking typeful meaning to both the program and the programmer, results in costly bugs and limited application lifetime. Semantic computing is dynamic, extensible, and conveys typeful meaning to the program and programmer.  applications have less bugs when using semantic types rather than native value types, semantic types have meaning to both program and programmer, and a semantic architecture is more resilient to product enhancements, technology changes, and so forth.


3 thoughts on “What is Semantic Computing, and Why do we Need It?

  1. Dear Sir

    Thanks for a simple introduction with an easier example to Semantic Programming. I really enjoyed it.

    We can see that extra classes and functions and code is introduced for the making things more clearer. Apparently, then can slow down the code, but compiler optimization and tweaking can be performed easily to remove the extra code according to the situation.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s