Aug 10, 2010

My take on the new DDS C++ PSM

It has been a while since we've started the standardization of a new C++ API for DDS (namely the ISO C++ PSM for DDS). Now we are getting close, on principle the standard should be voted during the September meeting, yet there are still a few points to resolve among submitters. If I look back at the IDL-derived C++ API and what will be the new, SimD-inspired, API I believe the result is great. In this and subsequent post, I'll share with you an outlook of what our current proposal for the final C++ API standard looks like. Your comments will be useful as they might be able to still influence how the API will look like.

To start with, let's take a look at a simple writer:


int main(int, char**) {
int domainId = 0;

try {
// Create Domain + Topic + Pub
dds::domain::DomainParticipant dp(domainID);
dds::topic::Topic<MiB> topic("MessageInABottle", dp);
dds::pub::Publisher pub(dp);

// Create DataWriter
dds::pub::DataWriter<MiB> dw(pub);

// Write Sample
MiB sample(1, "Hello");

// You can write like this...
dw.write(sample);

// ...and like this (and there is more...)
dw << sample;
}
catch (const dds::core::Exception& e) {
std::cout << e << std::endl;
}

return 0;
}



Now we can look at a more "complex" example in which we set custom QoS on the Publisher and DataWriter:



int main(int, char**) {
int domainId = 0;

try {

// Create Domain + Topic + Pub
dds::domain::DomainParticipant dp(domainID);

dds::topic::Topic<MiB> topic("MessageInABottle", dp);

// Publisher
dds::qos::PublisherQos pubQos;
dds::qos::Partition partition("TheCoolAPI");
pubQos << partition;

dds::pub::Publisher pub(pubQos, dp);

// Subscriber
dds::qos::SubscriberQos subQos;
subQos << partition;
dds::sub::Subscriber sub(subQos, dp);

dds::qos::DataWriterQos dwQos;
dwQos << Reliable() << TransientDurability();

dds::pub::DataWriter<MiB> dw(topic, dwQos, pub);
MiB mib;
mib.msg() = "ciao";

// You can write like this...
dw.write(mib);

// ...and like this (and there is more...)
dw << mib;

}
catch (const dds::core::Exception& e) {
std::cout << e << std::endl;
}

return 0;
}


That's it for this post. I'll let you know digest the code and perhaps give some comments on how you like it. Next will be a post showing the reader side.

A+

Jun 18, 2010

SimD v0.8 now available

I've released SimD v0.8 a few minutes ago. This new version includes a few extensions to the read API, now supporting iterators as well as std::vector and a refactored signal/slot API. Linux and Windows versions are available for download

Jun 15, 2010

Designing Distributed Systems with SCALA and DDS

In the past few months I've been experimenting with Scala a relatively new programming language targeting the JVM (and .NET). Differently from some of the latest programming languages targeting the JVM such as Groovy or Clojure, Scala is statically typed and features a very powerful type system with sophisticated type inference -- meaning that the compiler will infer types for you whenever possible thus limiting the need for typing them explicitly.

Scala provides a well balanced blend of imperative and functional programming mechanism which, I have to admit, seem to always give you the right tool to address a programming challenge in the most elegant manner.

Another very interesting aspect of the language, especially for those that have to deal with large systems, is that it has been designed ground up to be scalable, meaning that Scala supports equally well the development of small applications as well as big systems and system of systems.

Last but not the least, Scala is fully interoperable with Java, meaning that you can reuse Java Classes in Scala applications and viceversa. In summary, if you are a Java programmer, I think, you should definitively take a look at Scala and seriously consider moving to it.

Performance... Right, you might be wondering about Scala's overhead. In my experience in using Scala for distributed applications I've not seen any difference w.r.t. Java. This is consistent with what reported by other Scala users -- Scala matches Java in terms of performance.

Assuming that now you are agreeing that Scala is a great language for developing your next application, and be aware that companies like Twitter, SIEMENS, SONY and many others have taken that route, let's explore why Scala and DDS is a great combination.



There are several reasons why the combination of Scala and DDS is very natural, so let's explore two of those. First, DDS, differently from many other Pub/Sub technologies allows you to preserve the user-defined-types end-to-end. What do I mean with this? If you think about an application in abstract terms, you can think of it as a computation applying operators (or operations) on types. Some of these types might be native to your programming environment, such as Int, String, List, etc., other might be user-defined such as FinancialInstrument, RadarTrack, FlightDataPlan, etc. Programming languages usually give you abstraction to build user defined types and operate over them. DDS, provides you abstractions to distributed user defined types, without loosing type information, across applications in a distributed system. This means, that your application does not have to deal problem of representing user-defined-types into some other type that can be handled by the distribution technology (e.g. a specific JMS Message, or a sequence of bytes) . Applications using DDS always and only deal with user-defined-types. This has some important implications in terms of simplicity, code clarity, efficiency and safety.

As a result when combining Scala and DDS you have a statically typed programming language and distributed middleware that allow you to preserve your type invariants end-to-end.
At this point some people will raise the issue that types get you into troubles when you are trying to extend your system. This is true for inflexible type systems, however both Scala and DDS (with the newly adopted specification on Extensible and Dynamic Topic Types) provide you with structural type system that while preserving all the good properties of a sound type system nicely support type extensibility and evolution.

The second reason why I think that Scala and DDS are a very good combination is that it provides an actor model for building concurrent and distributed applications. The actor model matches very nicely with DDS and provides you an elegant and effective abstraction for building distributed systems.

There are several other reasons that I could list for choosing Scala and DDS for distributed applications. One of the other may is the native support for dependency injection supported by Scala, the other will probably be explored in some future post.

A+

Jun 10, 2010

Living in a world of self-proclaimed world leaders

It's some time I don't post on this blog, not so much because I've not had much to say. Anyway, here we are, although it is 21h38 Paris time, I am just done with my second Webcast on "Building Distributed Systems in Scala with OpenSplice DDS" (see http://bit.ly/9A8ew1) and I've not yet had dinner -- I just saw something that is way to funny and could not resist sharing my thoughts.

Well, don't know how you take "self-proclamation" but personally I find it funny not to say a bit ridiculous. People or companies coming up and saying "I am the world best whatever", or "I am the world leader in whatever" just sounds funny to me. Maybe this is cultural, as in my country we believe that it is up to the others to establish if you are the best. As such, the only one who takes the liberty of "self-proclamating" himself (or I should say itself) as the best is Silvio Berlusconi... He, believe it or not, "self-proclaimed" himself the best Prime Minister of the Italian history... I hope that Alcide De Gasperi did not hear him :-)

Anyway, I saw that the habit and attitude toward of "self-proclamation" is spreading (perhaps it is infectious) and after becoming insensitive to those who proclaim themselves as "DDS World Leader" now I saw those who just decided to self-graduate into "Small Footprint DDS world leader".

Don't worry, I am not envy of all these world leaders that seem to appear like mushrooms, and don't worry we won't self-proclaim ourself into anything. Yet, I wonder how these people score in Geography. I start to suspect that their view of the world might be slightly skewed or constrained to a small fraction for the entire globe.

A+

Jul 15, 2009

DDS Interoperability Demonstrated

Yesterday afternoon, precisely at 15.30 US ET time the interoperability between different DDS vendors was once again demonstrated. Thanks to a very successful demonstration, OpenSplice DDS is now the first and only Open Source DDS implementation providing interoperability!

A set of slides describing the scenarios that were demonstrated is available here.

Ciao!

Jul 14, 2009

The DDS Interoperability Demo - Reloaded

In a few hours we are going to demonstrate interoperability between different DDS implementations, namely PrismTech's OpenSplice DDS, RTI's DDS, and TwinOaks CoreDX.


This time I'll be demonstrating the interoperability of OpenSplice DDS Community Edition, namely the Open Source version of OpenSplice DDS.

More later.

Ciao!

Jul 12, 2009

The OMG Real-Time Workshop

Following a tradition established over the course of many years, the OMG Real-Time Workshop goes live again tomorrow. The 2009 edition (see http://bit.ly/vcGCd) is strongly centered around DDS, showing how this technology is really picking and quickly walking the path toward becoming the next big thing.


The first day of the Workshop, Monday the 13th, will be full dedicated to Tutorial and will features:

  • OMG DDS Tutorial (full day)
  • UML Profile for DDS Tutorial (Half Day)
  • UML profile for Modeling and Analysis of Real-time and Embedded systems (Half Day)

I'll be giving the DDS Tutorial along with Gerardo Pardo and the UML for DDS Tutorial with Sam Mancarella.


The second and third day of the Workshop, namely Tue 14th and Wed 15th, will be dedicated to paper presentations and the DDS Interoperability Demonstration.


If you want to see the full list of papers check out http://bit.ly/vcGCd I'll try to write up the most interesting things that will be happening.


Ciao!