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.

Posted in Software Development | Tagged , , | Leave a comment

Distributed Semantic Computing


I’ve written an article on Distributed Semantic Computing:

Read the full article on Code Project: http://www.codeproject.com/Articles/1012650/Distributed-Semantic-Computing


In this article, I will demonstrate distributed semantic computing using a Type-First Development (TFD) approach, a term first coined by Tomas Petricek in his blog entry “Why type-first development matters.”

In this article, I’ve re-written the HOPE engine to utilize “type declarative programming.”  This is a style of programming that relies heavily on generics to declaratively describe what should be done, not how.  It is the other side of the TFD coin — in addition to developing types first, we also implement processes that operate on generic types, particularly those that implement specific interfaces.  Similar to how events, delegates, callbacks, and so forth are used for an inversion of control with regards to program behavior, “type declarative programming” is an inversion of control for instantiating objects.  Unlike HOPE, where types are declared in XML and compiled at runtime, here we use types implemented in the code itself.  Because of .NET’s rich reflection and assembly loading capabilities, the difference is irrelevant to the overall goals of HOPE, but the difference to the developer is significant, especially with regards to the safety that a typed language gives you at runtime and the ease of programming (Intellisense and compile-time checking) in a typed language during development.

Type First Development (coined by Tomas Petricek) is applicable to imperative languages as well as functional languages.  We can use the C#’s type system to create rich types and declaratively establish the relationship between types and the methods that process those types.  We can also create containers (membranes) to create computational islands and control the flow of type instances between computational islands.  By using a semantic processor, the membranes, types and receptors that are declared in a “semantic system” becomes a expressive computational unit.  Specialized receptors, such as the distributed receptors illustrated in this article, demonstrate how easy it is to create a distributed semantic computing system.

Posted in Higher Order Programming Environment, Software Development | Tagged , , , | Leave a comment

Monitor GitHub Activity With Event, Project Description, and Language Word Clouds

Watch github events in more-or-less real time as we display a word cloud of events, project descriptions, and project languages.

This article also reveals a couple tricks that need to be employed to obtain a GitHub access token with C#/.NET.  If you’re stuck trying to figure out server response errors, read this article!


Article: http://www.codeproject.com/Articles/878864/Monitor-GitHub-Activity-With-Event-Project-Descrip

Posted in Software Development | Tagged , , | Leave a comment

View Filtered Tweets in a Word Cloud

Using a couple open source packages, I glue together a tweet stream and display the word hits in a word cloud using a force directed graph.



Article: http://www.codeproject.com/Articles/877365/View-Filtered-Tweets-in-a-Word-Cloud

Video: https://www.youtube.com/watch?v=vEH_1h0jrZY


Posted in Software Development | Tagged , , | Leave a comment

Setting up an Android test application in IntelliJ

This may not be the best approach, but I figured I’d document the process that I go through, especially because it turns out there’s some hidden gotcha’s that took a bit of sleuthing to figure out.

1:  Fire up IntelliJ and select New Project from the File menu.  For there, select Android from the list on the left, and “Application Module” from the list on the right.

newProjectI would rather not create an application simply for testing, but this is the only option that allows you to select the target device (emulator or actual device.)

2: Click on Next and fill in the application, package, and activity name:

appName3: Click on Next and fill in the project name, select the project SDK, and select the target device.  These need to be configured for your own requirements regarding which SDK to use and how you are working with Android (emulation or actual device):

projectInfo4: Click on Finish.

5: If you haven’t done so, and you’re using an actual Android device, connect it and wait for the “AutoPlay” dialog to appear.  I learned that this may take a while — under a minute, but still I learned that you have to wait for this to happen before the IntelliJ will talk to the device.  Once the AutoPlay dialog appears, close it.

6: Right-click on the project and select New -> Module:

newModule7: Select “Test Module”:

newModule28: Click on Next and enter a module name:

newModule39: Click on Finish.  IntelliJ creates a “BlankActivityTest” file.  Delete this file:

deleteActivityTest10: Right click on the package under “src” and add a new Java class.  Provide a class name:

testClassName11: Start writing tests!

Easier said than done.  First off, you’ll need at least the following import;

import android.test.InstrumentationTestCase;

Next, you want to change your class so that it extends InstrumentationTestCase:

public class Tester extends InstrumentationTestCase {
    public Tester() {

You can add setUp and tearDown processes as well:

    protected void setUp() throws Exception {

    protected void tearDown() throws Exception {

Note that these functions must declare that they “throw Exception”

Finally, you can write some tests.  Tests must being with the word “test”!

    public void test1() {
        assertEquals(1, 1);

    public void test2() {
        assertEquals(1, 2);

That’s it!  Happy unit testing on Android using the IntelliJ IDE.



Posted in Android, IntelliJ, Java | Tagged , , , | Leave a comment

Finding the distance from a Point to a Bezier Segment

A nice article on Code Project by a great guy, Super Lloyd.

To quote:

“I needed to find the distance from a Point to a Bezier Segment. Turns out you need lot of Math tools.  A polynomial class which can do simple math, derivate and find its roots. As well as Complex arithmetic.”

Comes with a nifty UI to play with!

Posted in Software Development | Tagged , , | Leave a comment

The Bug that Destroyed a Rocket

This is a great read!

Posted in Uncategorized | Leave a comment