tag:blogger.com,1999:blog-38974545726322762012024-03-13T14:36:38.486-04:00Media & Device ControlCapability-based programming is a development methodology that extends and restricts Interface-based programming, where each interface is uniquely identified, represents a small concise feature, and is used, with other interfaces, like building blocks to construct complex behaviors. In other words, building blocks for programming.
<p>
The views expressed herein do not reflect the views of my employer or any Standards Development Organizations with which I work.</p>Steve Posickhttp://www.blogger.com/profile/12374968504765500674noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-3897454572632276201.post-14213465719444100492015-09-13T22:14:00.005-04:002016-12-19T14:49:45.233-05:00Features, Interfaces, & Data as Resources<h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">What are Resources?</span></h2>
<span style="background-color: white; color: #252525; line-height: 22.4px;"><span style="font-family: "arial" , "helvetica" , sans-serif;">A <b>resource</b> is something that is available to fulfill some systemic or human need.</span></span><span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="background-color: white; color: #252525; line-height: 22.4px;">The IETF Uniform Resource Identifiers (URIs): General syntax specification [<a href="http://tools.ietf.org/html/rfc3986" target="_blank">RFC 3986</a>] defines a resource simply as "<i>whatever might be identified by a URI.</i>" This broad and generic definition of a resource allows for many possibilities in software applications, as resources may be</span><span style="background-color: white; color: #252525; line-height: 22.4px;"> systems, devices, services, components, data, and even program units.</span></span><br />
<h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">What is an Interface?</span></h2>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Generally speaking an <b>interface</b> is a contract of behavior, defined so that two or more resources can interoperate with one another. Interfaces may be defined using formal definition languages, such as IDL, within programming languages, such as Java, or they can simply be human-readable documents. </span></div>
<h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">What is a Feature?</span></h2>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">For the purposes of this document, a <b>feature</b> is the "smallest unit of control" or more specifically a collection of variables and units of code</span><span style="font-family: "arial" , "helvetica" , sans-serif;">, e.g., attributes, properties, </span><span style="font-family: arial, helvetica, sans-serif;">procedures</span><span style="font-family: arial, helvetica, sans-serif;">, functions, and/or </span><span style="font-family: arial, helvetica, sans-serif;">methods,</span><span style="font-family: "arial" , "helvetica" , sans-serif;"> that interact with those variables to perform a an atomic user requirement, e.g., change a TV channel, setting the output volume of an audio device, set the temperature of a heater, or get the </span><span style="font-family: arial, helvetica, sans-serif;">temperature reading from a thermostat.</span><span style="font-family: arial, helvetica, sans-serif;"> When defined in such a granular fashion features can be combined to construct complex behaviors, using standard, interoperable, and/or well-known methods that resources and programs can use to interact.</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">For example, setting and getting the temperature of a thermostat, an oven, an air conditioner, or a water heater are essentially the same for all of these resources / devices, just as playing, fast forwarding, and rewinding media is the same for the media devices and services that implement the playout of media, whether the resource is a software service, a Blu Ray players, a digital Video Recorder (</span><span style="font-family: arial, helvetica, sans-serif;">DVR), video camera, or a professional digital media server.</span></div>
<h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Feature Interfaces</span></h2>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">In most legacy applications interfaces were defined as monolithic structures, including all of the behaviors and attributes implemented by an object, service, or component. But </span><span style="font-family: "arial" , "helvetica" , sans-serif;">with the advent of</span><span style="font-family: "arial" , "helvetica" , sans-serif;"> </span><b style="font-family: Arial, Helvetica, sans-serif;">Microservices</b><span style="font-family: "arial" , "helvetica" , sans-serif;"> </span><span style="font-family: "arial" , "helvetica" , sans-serif;">and other</span><span style="font-family: "arial" , "helvetica" , sans-serif;"> </span><b style="font-family: Arial, Helvetica, sans-serif;">feature-based development</b><span style="font-family: "arial" , "helvetica" , sans-serif;"> </span><span style="font-family: "arial" , "helvetica" , sans-serif;">methodologies, such as the Capabilities defined in the SMPTE ST2071 suite of standards, interfaces can be used to define the behavior and attributes of individual features, with these </span><span style="font-family: "arial" , "helvetica" , sans-serif;"><b>feature interfaces</b> being plain old interfaces defining a narrow scope of behavior, one feature, e.g., Get </span><span style="font-family: arial, helvetica, sans-serif;">Temperature.</span><span style="font-family: arial, helvetica, sans-serif;"> This programmers to </span><span style="font-family: arial, helvetica, sans-serif;">describe the behavior of</span><span style="font-family: arial, helvetica, sans-serif;"> resources in a standard, vendor, device, and service agnostic fashion and for client developers to write to a set of predefined features without regard for the resource that will be implementing the feature interfaces. Since each feature interface contains a small number of functions and variables, comprehensive tests can more easily be developed against the feature interface. Thus allowing for greater security and better overall quality of the implementations; as developers are more willing to write 10 to 15 unit and security </span><span style="font-family: arial, helvetica, sans-serif;">tests </span><span style="font-family: arial, helvetica, sans-serif;">for an interface that defines only 2 or 3 functions than they are to write the equivalent test coverage for monolithic interfaces containing 15, 20, 30 or more functions. Developers are also more likely to miss the full gamut of functional and security related tests for larger interfaces, the chances of and number of tests missing growing with the size of the interface. These tests can be developed against the ideal expectation of the feature interface, guaranteeing that compatible implementations perform exactly as the API designer intended.<br /><br />Feature interfaces can also be aggregated like building blocks to describe complex behaviors and interactions, while adding a measure of isolation between each feature. When done properly, a resource can have its functionality fully described and allow new features added without negatively impacting clients. While REST helps to mitigate this specific issue, the client compatibility issue still remains for strongly types systems and does not provide a standardized means for a resource to implement multiple versions of the same featureset, making backward compatibility with older clients much easier. In addition, new resources can be added to the network or system and clients written to specific features will be able to interact with those new resources without change. When combined with a service discovery protocol, the clients will not even need a configuration change.</span></div>
<h2>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Interfaces as Resources that Describe Features</span></h2>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Using the generic definition of a <b>resource</b>, an <b>interface</b> can also be a resource; a resource that defines how two or more other resources will interoperate with one another. Each of these <b>feature interfaces</b> can then be uniquely identified using a URI. With the unique identification of these feature interfaces methods can easily be constructed to facilitate the discovery of the resources that implement these </span><b style="font-family: arial, helvetica, sans-serif;">feature interfaces </b><span style="font-family: arial, helvetica, sans-serif;">in an automated fashion</span><span style="font-family: arial, helvetica, sans-serif;">.</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Please note that the programming language(a) used to implement these concepts do not need to implement formal interface support, as these interface definitions can be defined in human-readable documentation.</span></div>
<h3>
<span style="font-family: "arial" , "helvetica" , sans-serif;">Example of a Feature Interface and Its Identity</span></h3>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;">The following is a series of feature interfaces used to define the features implemented by a thermostat. The interfaces can be mixed and matched, like Lego(tm) blocks to define the specific thermostat implementation, e.g., household tempurature control, an oven, an air conditioner, a generic tempurature sensor, or a centralized service controlling such a system.</span></div>
<div>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">@Identity("feature://api.example.com</span><span style="font-family: "courier new" , "courier" , monospace;">/thermostat</span><span style="font-family: "courier new" , "courier" , monospace;">/TempuratureSupport")</span></div>
<div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">public
interface </span><span style="font-family: "courier new" , "courier" , monospace; line-height: normal;">TempuratureSupport</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> float getTemperature();</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">}<br />
</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">@Identity("feature://api.example.com</span><span style="font-family: "courier new" , "courier" , monospace;">/thermostat</span><span style="font-family: "courier new" , "courier" , monospace;">/SetTempurature")</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">public
interface SetTemperature</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> public void setTemperature(float
temperature);</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">}<br />
</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">@Identity("feature://api.example.com</span><span style="font-family: "courier new" , "courier" , monospace;">/thermostat</span><span style="font-family: "courier new" , "courier" , monospace;">/ZoneSupport")</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">public
interface ZoneSupport</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> public int[] getZones();</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> public int getZone();</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> public String[] getZoneNames();</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> public void setZone(int zone);</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">}<br />
</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">@Identity("feature://api.example.com</span><span style="font-family: "courier new" , "courier" , monospace;">/thermostat</span><span style="font-family: "courier new" , "courier" , monospace;">/SetZone")</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">public
interface SetZone</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> public void setZoneName(String name);</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">}<br />
</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">@Identity("feature://api.example.com</span><span style="font-family: "courier new" , "courier" , monospace;">/thermostat</span><span style="font-family: "courier new" , "courier" , monospace;">/</span><span style="font-family: "courier new" , "courier" , monospace;">ModeSupport</span><span style="font-family: "courier new" , "courier" , monospace;">")</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">public
interface ModeSupport</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> public enum MODE {</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> HEAT, COOL, AUTO;</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> }<br />
</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> public MODE getMode();</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">}<br />
</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;">@Identity("feature://api.example.com</span><span style="font-family: "courier new" , "courier" , monospace;">/thermostat</span><span style="font-family: "courier new" , "courier" , monospace;">/SetMode")</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">public
interface SetMode</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">{</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;"> public void setMode(MODE mode);</span></div>
<div style="direction: ltr; line-height: 80%; margin-bottom: 0pt; margin-left: 0in; margin-top: 0pt; text-indent: 0in; unicode-bidi: embed; word-break: normal;">
<span style="font-family: "courier new" , "courier" , monospace;">}</span></div>
<!--EndFragment--></div>
Steve Posickhttp://www.blogger.com/profile/12374968504765500674noreply@blogger.com0tag:blogger.com,1999:blog-3897454572632276201.post-48006991057924860052013-12-30T14:47:00.000-05:002014-07-01T09:34:28.976-04:00Capability-based Programming<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i>Capability-based programming</i> is a development methodology that is closely related to <i>Interface-based programming</i>, where a cross-platform, "practically" globally unique, identity is assigned to each interface, each interface represents a small concise feature or function, known as a "capability", and capabilities are used as building blocks to construct complex behaviors, in much the same way as toy plastics building blocks are used to construct toy plastic planes and trucks.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i>Capability-based programming</i> is designed to meet the unique requirements of device control scenarios, such as the <i>Internet of Things</i> (<i>IoT</i>)<span class="s1"><sup>[1]</sup></span>, where complex behaviors are best modeled as collections of small concise behaviors that reflect the "atomic" features of the "thing". The basic principles of <i>Capability-based programming</i> have been around since the inception of the interface, and technologies like <i>COM</i>, <i>DCOM</i>, and <i>Corba</i>. However, the scope of identity for each interface was previously limited to the development project, organization and/or development platform.</span><br />
<h3>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">The Origins of </span><i style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">Capability-based Programming</i></h3>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><i>Capability-base programming</i> was originally
developed to support the unique requirements presented by device control
problems, such as the control of media & devices over Internet Protocol
networks and the <i>Internet of Things</i><sup>[1]</sup>.
It took its roots in the work generated from the Society of Motion
Picture and Television Engineers (SMPTE) Ad hoc Group on Media & Device
Control over IP Networks. Now you might be thinking "SMPTE?
Really?", but it makes perfect sense when you look at the unique
challenges faced by the Professional Media industry and its need
to orchestrate complex workflows with heterogeneous systems. Back in
2010, before the <i>Internet of Things</i><sup>[1]</sup> became a
widely accepted term, the SMPTE began an effort to develop a new standard
for the vendor agnostic control of media centric devices over Internet Protocol
(IP) networks. Prior to this, standards did exist for the control of
media centric devices using serial communications protocols, such as RS-422 and
RS-232, but efforts to transpose these serial protocols to new IP-based systems
had failed.<br />
<br />
The first task of the newly created "SMPTE 34CS - Adhoc Group on
Media & Device Control over IP Networks" (34CS MDCoIP) was to
determine why previous attempts at transposing, historically successful, serial
protocol standards into new IP-based standards had failed. What 34CS
MDCoIP had found was that the traditional, rigid, object models used to create
the new IP-based protocols were their Achilles heels. Unlike their serial
counterparts, these new IP-based protocol standards were designed
using Object Oriented Programming (OOP) and Object Oriented
Design (OOD) techniques, resulting in protocols that vendors could not
extend without breaking interoperability. This is due to the fact that
object extensibility requires that an object's consumer has access to the
object's base definition plus the definition of the extensions in use.
This works well for object consumers within the same memory space, but
when serialization is involved, the object's consumer might not have access to
both the base object definition and its extensions. In fact, this is
almost always the case with standardized protocols and therefore, the object's
consumer will likely NOT be able to deserialize the objects that have been
extended. This left vendors with two choices, create their own
proprietary protocol or implement a protocol that makes them look and act
just like everyone else; since the later choice would eliminate the vendor's
ability to add functionality and impact their bottom-line, they went with the
obvious choice and implement their own proprietary protocols.<br />
<br />
Armed with this knowledge, the 34CS MDCoIP ad hoc group took one of the
object models designed to represent professional media devices and inverted it.
What they discovered was that, at its core, every object is composed of
groups of attributes, operations, and signals (aka. events) that work together
to define concise features for that object. These features, defined as
"capabilities", can be described as distinct interface definitions
and can in turn be assembled, like building blocks, to represent complex
behaviors that can be changed dynamically. Thus allowing objects to change
their behavior, or mode of operation, on the fly, at runtime. The object's
consumer is then able to work with the capabilities that it understands, while
ignoring the capabilities that it does not, providing the protocol
extensibility that the rigid object models lacked. Capability-based
programming was born.</span>
<br />
<h3>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><b>The <i>Internet of Things</i> (<i>IoT</i>)<span style="font-size: xx-small; vertical-align: super;">[1]</span></b></span></h3>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The <i>Internet of Things</i> (<i>IoT</i>)<sup>[1]</sup> refers
to an Internet-like structure, or network, where each device and its virtual
representation is uniquely identifiable and accessible. As more and more
devices become network-attached and are made "smarter", the desire to
manipulate those devices increases, making the <i>IoT</i> the next
logical step for the Internet and similar network platforms. Smart Homes
are a superb example of this phenomenon, who wouldn't want their house to
unlock the door for them when their hands are full, notify them if
something goes wrong, or even set the temperature and mood music,
upon their entry? But Smart Homes are just the tip of the iceberg; there
are many applications for the <i>IoT</i> in business and professional
settings. For example, the Professional Media industry requires
precise coordination between many disparate devices, at every stage of the
media production process, in order to implement automation and rights
management, all the way down the chain to the consumer viewing of the media on
a television or a mobile device.</span>
<br />
<h3>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Decommissioning</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"> the Object</span></h3>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">In the days before <i>Object Oriented Programming</i>,
program code and data were stored separately, the code having full access
to the data. Programmers had to be ever-mindful of where and how the data
was manipulated. Then <i>Object Oriented Programming</i> was
invented and the data and the code to manipulate that data could be
encapsulated within the same programmatic unit, called an Object. For the
first time programmers could control how and from where the data was
manipulated. <i>Object Oriented Programming</i> simplified
development by allowing programmers to break programs into components, with
each component behaving in a defined fashion and implementing a specific set of
operations, attributes, and signals. These behavioral definitions became
known as interfaces and applications could be designed in a modular fashion,
allowing separate teams to develop different parts of a single
application. Components became services when programs began to interact
with one another over the network and/or through channels within common
hardware, and eventually the term <i>Service Oriented Architecture</i> (<i>SOA</i>)
was coined.</span>
<br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Interfaces are used to define the public facing
behavior of a service. With each interface fully describe the service,
aggregating all of its capabilities into a single interface. This
capability aggregation works well with services in homogeneous environments,
but in heterogeneous environments such as the <i>Internet of Things</i><sup>[1]</sup>, this aggregation
of characteristics not only becomes unmanageable,
but becomes impossible to implement. The solution, don't
aggregate the service's capabilities into a single interface, make the service
implement many interfaces, each representing a single capability and allow the
clients to access each capability independently from the others. Thus
allowing services to change their capabilities dynamically, as needed. When
clients are written to work with sets of capabilities, as opposed to service
interfaces, those clients will not require change as new capabilities are added
to services. In addition, those clients will begin to understand and
work with new services, as those services implement capabilities they
understand. For example, the newly invented Television Coffee Maker,
television clients can tune the channel, while coffee maker clients can brew
coffee. If the manufacturer later decides to add an "Ice Coffee"
feature, they simply add the "Add Ice" capability and clients that
know how to "Add Ice" can add ice, while other clients are not
impacted. And all without a single change to any of the clients
within the network.</span>
<br />
<h3>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The Requirements of </span><i style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">Capability-based Programming</i></h3>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The following
lists enumerate the requirements of <i>Capability-based programming</i>:</span><br />
<br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b>Interface Requirements</b></span><br />
<ol>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">A “practically” global unique identifier shall identify each interface.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Each interface shall specify the authoritative source that maintains the definition of the interface. The authoritative source may be indicated by the interface’s identifier.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Each interface endpoint shall be independently accessible from all other interface endpoints exposed by the service, device, or object.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Each interface should define a contract of behavior for a concise feature, function, or capability; implementing the minimal set operations, attributes, and signals required to implement a concise feature, function, or capability. The smallest unit of control.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The documentation and programmatic artifacts for each interface should be obtainable, over the Internet, using the interface’s unique identity.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Interfaces meeting these requirements shall be known as capability interfaces.</span></li>
</ol>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b>Service, device, and object Requirements</b></span>
<br />
<ol>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">A “practically” global unique identifier shall identify each service, device, and object.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Services, devices, and objects shall implement one or more capability interfaces.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Services, devices, and objects shall only be accessed via their capability interfaces.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Services, devices, and objects shall provide a means by which the set of exposed capability interfaces can be identified, iterated, and/or listed.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Services, devices, and objects may change the capability interfaces they expose, on the fly, at runtime, to support different "modes of operation."</span></li>
</ol>
<h4>
<b style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">What is a "Practically" Global Unique Identifier?</b></h4>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">A "practically" global unique identifier consists of two parts, the <b>Authority</b> and the <b>Value</b>. The Authority is the organization, algorithm, and/or registry by which the uniqueness of the Value is guaranteed. For example, an identifiers Authority may</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"> be an organization such as the IANA,</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"> </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">an algorithm such as the one specified in the UUID specification [IETF RFC 4122], or it may be a registry such as the Registrars assigned by the Domain Name System (DNS). The Value may consist of any byte pattern designated by the Authority.</span><br />
<br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">"Practically" global unique identifiers may also be constructed from multiple parts. For instance, a namespace combined with a name, unique to that namespace, may be "practically" globally unique, if the namespace is prefixed with a legitimate, registered, DNS domain name. For example, the interface name "net.posick.SomeInterface" is </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">"practically" globally unique if the registrant of the "net.posick" domain name provides guarantees that the interface name shall be, and shall remain, unique</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">. This type of identifier provides the least guarantee of uniqueness, unless an appropriate Trust Framework<span style="font-size: xx-small; vertical-align: super;">[3]</span> is established, defining a governing organization, registry, and/or algorithm e.g.,</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"> </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">the ISO,</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"> </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">the IANA, the SMPTE, or IETF RFC 4122.</span><br />
<h4>
<b style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">How do Unique Identifiers Apply to Interfaces?</b></h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Unique identifiers apply to interfaces in every
Interface-based application ever built. It might not be apparent to the
casual observer, but each interface must have a name that is unique to the
application, development project, and/or organization that is responsible for
the development of that application. The compiler requires this
uniqueness of the name, in order to link to the proper programmatic artifacts.
Namespaces were developed to help mitigate the issue of unique naming and
have been used since to guarantee the uniqueness of interface names at a larger
scale. It is a little recognized fact that most developers tend to make
efforts to guarantee the uniqueness of their interface names, at a global
scale, by using namespaces that are unique to the application, project, and/or
organization and application, project, and/or organization names that are
"practically" globally unique. In fact, most modern programming
platforms, such as Java, .Net, and XML encourage the use of registered domain
names as namespace prefixes, thereby helping to guarantee the
"practical" global uniqueness of the interface names, as the
namespace prefix is guaranteed to be globally unique by the DNS Registrar and
the namespace suffix and interface name are chosen to be unique within the
namespace prefix by the organization and/or development team.</span>
<br />
<h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><b>Who or What is an "Authoritative Source?"</b></span></h4>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">An Authoritative Source is an entity (e.g., an organization, a person, or a registry) that maintains an interface and guarantees the uniqueness of each interface within its scope. The scope of the Authoritative Source can be identified by a domain name, a namespace, or combination thereof.</span>
<br />
<h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">How are Capability Interfaces defined?</span></h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">An Authoritative Source is an entity (e.g., an organization,
a person, or a registry) that maintains an interface
and guarantees the uniqueness of each interface within its scope. The
scope of the Authoritative Source can be identified by a domain name, a
namespace, or combination thereof.</span>
<br />
<h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">How do Capability Interfaces Differ from Regular Interfaces?</span></h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Capability interfaces differ from regular interfaces in 2 ways.</span>
<br />
<ol>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Capability interfaces have a "practically" globally unique identity.</span></li>
<li><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Capability interfaces represent a concise feature or function, aka. a capability.</span></li>
</ol>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The unique identity of a capability interface can be as simple as the name of the interface and the namespace to which the interface is bound, or the identity could be an identifier associated to the interface via an attribute, a registry, or even just via documentation. For example, in the <i>Microsoft Windows</i> operating system, <i>ActiveX</i>, <i>COM</i>, and <i>DCOM</i> objects are associated to Globally Unique Identifiers (GUIDs) within the <i>Windows Registry</i>. All that matters is that everyone agrees that "foo" is "foo" and not "bar".</span><br />
<br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">A concise feature or function can be thought of as "the smallest unit of control" or the minimum number of attributes, operations, and signals needed to implement a specific feature. For example, a t</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">emperature </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">sensor might expose a </span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">t</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">emperature </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">value that can be read by consumers. An implementor might choose to create a "Read Temperature Value" interface or they might decide to be more generic and implement a "Read Float Value" interface. The choice is intentionally left up to the implementor for flexibility.</span>
<br />
<h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Who can define new Capability Interfaces?</span></h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Anyone who can define an interface and guarantee the uniqueness of its name or associated identity can create capability interfaces. In other words, anyone who can register their own domain name or has the authority to create unique names within a domain </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">can define capability interfaces. It's not hard to guarantee "practically" unique identity, we do it all the time by using our registered domain names as part of our namespace names.</span>
<br />
<h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Does Capability-base Programming Support Traditional, Legacy, Interfaces?</span></h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Absolutely, 100%, unequivocally, Yes!</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">To convert a regular interface into a capability interface, all one needs to do is assign a "practically" globally unique identity to that interface, if it does not already have one.</span><br />
<h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Can the Interface's Namespace and Name be used for Unique Identity?</span></h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Yes, however, if there are multiple versions of the same interface, each version requires a unique identity of its own. This may be managed with the namespace or it may be managed by associating a completely independent identifier to the interface and a specific version of that interface via documentation or via a registry. The identifier may be a GUID, UUID, URN, Fully Qualified Namespace Name, or any other identifier type or format that is capable of guaranteeing uniqueness.</span>
<br />
<h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Can Capability Interfaces Inherit From or Extend other Interfaces</span></h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Yes.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">A capability interface is no different than any other interface, except that they should represent small concise features or functions and they must be "practically" globally uniquely identified. Please note that this identity may be specified in documentation or by the interface namespace and name.</span>
<br />
<h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Can a Capability Interface Depend on other Capability Interfaces?</span></h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Yes and No. </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">A capability interface should define all of the attributes, operations, and signals required to implement a concise feature or function, and therefore, should not depend upon the existence of another interface. But in a </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">service,</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"> </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">device, or object, each capability interface interacts with the same state and therefore, for the specific </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">implementation, a capability interface may depend on other capability interfaces to assist in the proper manipulation of state.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">For example, a media device that can load and play media may require 4 capability interfaces</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"> ("Load", "Eject", "Play", and "Stop")</span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"> that depend on one another to implement a rudimentary play-out application. For the specific implementation of this service, each interface depends on the others, at runtime, to offer their feature or function, but the interfaces do not have a static dependency upon one another. In other words, the interface definitions do not depend on any other interfaces. The dependencies are contingent on the device, service, or object implementing them and how it requires its internal state to be manipulated.</span><br />
<h3>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><span class="s1">Service</span> Oriented Architectures (SOA<span class="s1">)</span> vs Capability<span class="s1">-based</span> Programming</span></h3>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Capability<span class="s1">-</span>based programming <span class="s1">can</span> be thought <span class="s1">of</span> as a <span class="s2">new</span> way of <span class="s1">defining</span> and assembling <span class="s1">interfaces</span> to describe <span class="s1">service</span> behaviors. Instead of <span class="s1">creating</span> a single<span class="s1">,</span> monolithic, <span class="s3">interface</span> that <span class="s1">represents</span> <span class="s1">the</span> <span class="s1">full</span> <span class="s1">behavior</span> <span class="s1">of</span> a service, the <span class="s1">behavior</span> <span class="s1">of</span> <span class="s1">the</span> <span class="s1">service</span> <span class="s1">is</span> <span class="s1">described</span> <span class="s4">by</span> <span class="s1">using</span> many smaller, <span class="s1">well-understood, interfaces, known as capability </span><span class="s4">interfaces</span><span class="s1">. These</span> <span class="s5">capability</span> <span class="s1">interfaces</span> <span class="s1">are</span> <span class="s1">in</span> <span class="s5">turn</span> <span class="s1">used</span> <span class="s1">by</span> <span class="s1">services</span> <span class="s1">in</span> <span class="s1">a</span> <span class="s4">Service</span> <span class="s1">Oriented</span> Architecture <span class="s1">to</span> <span class="s1">construct</span> <span class="s1">complex</span> <span class="s5">behaviors</span> <span class="s1">much</span> like <span class="s1">bricks</span> <span class="s1">and</span> mortar <span class="s1">are</span> <span class="s1">used</span> <span class="s1">to</span> <span class="s1">build</span> houses.</span>
<br />
<h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><span class="s6">Isn</span><span class="s1">'t</span> Capability<span class="s1">-based</span> <span class="s5">Programming</span> <span class="s1">just</span> SOA repackaged<span class="s1">?</span></span></h4>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">No, Capability<span class="s1">-based</span> <span class="s5">programming</span> <span class="s1">can</span> be used <span class="s1">to</span> extend <span class="s1">the</span> <span class="s1">capabilities</span> <span class="s1">of</span> a <span class="s1">Service</span> Oriented Architecture (SOA<span class="s1">)</span>, by allowing <span class="s1">complex</span> service behaviors <span class="s1">to</span> be constructed <span class="s1">from</span> many smaller, well<span class="s1">-</span>understood, well<span class="s1">-</span>defined, behaviors. But Capability<span class="s1">-</span>based programming <span class="s1">can</span> be used <span class="s1">with</span> any language<span class="s1">, platform</span>, and<span class="s1">/</span>or paradigm <span class="s1">that</span> supports the <span class="s1">notion</span> of <span class="s1">an </span><span class="s2">interface</span>. SOA is <span class="s1">not</span> needed <span class="s1">nor</span> implied.</span>
<br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">In other words, Capability-based programming complements SOA, by using smaller, well-known, interfaces as <span class="s7">"building blocks."</span> Consumers that understand the smaller <span class="s7">"building blocks"</span> can interoperate with <span class="s3">new</span> services, without change, and consumers can even work with services that only implement some of the <span class="s7">"building blocks"</span> that the client understands. For example, Television Coffee Maker clients can tune the channels of regular televisions or brew coffee on regular coffee makers. Flexibility galore!</span><br />
<h3>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Example of Capability-Based Programming in Java</span></h3>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The following example illustrates the flexibility and easy in which Capability-Based Programming methodologies can be introduced into existing programming languages, such as Java. Due to Java's strongly typed nature, type-casting must be used extensively within clients, however, language extension can be defined to remove this need.</span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The following class definition defines a simple thermostat interface, defined using traditional object modeling methodologies. Given this is a remote protocol (RMI), many Object Oriented Design principles do not apply, as messages are exchanged across process boundaries to facilitate method execution.</span></div>
<pre><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><code language="Java">
public interface Thermostat
{
public enum MODE
{
HEAT, COOL, AUTO;
}
public float getTemperature();
public void setTemperature(float temperature);
public MODE getMode();
public void setMode(MODE mode);
public int getZones();
public String getZoneName(int zone);
public void setZone(int zone);
public String[] getZoneNames();
}
</code></span></pre>
<br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">So what is the problem?</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">What if the manufacturer wishes to add new capabilities to the thermostat? </span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Lets say </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">the manufacturer</span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> wishes to add the inputs from a remote weather station. </span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Traditionally, the manufacturer would be required to define a new interface that extends the Thermostat interface or define a new Interface altogether. Once this is done and the thermostat is upgraded, legacy clients, and client that just understand the Thermostat interface, can no longer interoperate with the upgraded thermostat, as the binary signature and/or serialized name of the remote interface have changed. Clients must be upgraded before they can interoperate with the upgraded thermostat and anyone familiar with upgrading client software can tell you that the more clients you have, the more difficult it is to update them and worse, we can't upgrade all clients, we can only upgrade the clients that need to interoperate with an updated thermostat. If a client needs to talk to both upgraded and un-upgraded thermostats, it will need two client software installations. This is bad, very bad!</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Capability-Based Programming to the rescue. With Capability-Based Programming this is a non-issue, as each capability is defined with a distinct, concise, feature interface. As new capabilities are added, the device simply implements these new interfaces and provides the client with a list of interfaces it implements. The following example uses Capability-Based Programming methodologies to solve the above problem, note that each capability, including the ability to change a state value, is implemented as a distinct interface, this also simplifies security rules, as these rules can be applied at the interface level.</span><br />
<pre><code language="Java">
public interface Device
{
public String getID();
public String getName();
public String[] getCapabilities();
}
public interface TemperatureSupport
{
public float getTemperature();
}
public interface ConfigTemperatureSupport extends TemperatureSupport
{
public void setTemperature(float temperature);
}
public interface ZoneSupport
{
public int getZones();
public String[] getZoneNames();
public String getZoneName(int zone);
public void setZone(int zone);
}
public interface ConfigureZoneSupport extends ZoneSupport
{
public void setZoneName(String name);
}
public interface ModeSupport
{
public enum MODE
{
HEAT, COOL, AUTO;
}
public MODE getMode();
}
public interface ConfigureModeSupport extends ModeSupport
{
public void setMode(MODE mode);
}
</code></pre>
<br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">
In the above example, each capability of the thermostat is defined as a discrete interface. There is also a new interface defined, named "Device", that is common to all devices and implements the base programatic requirements of Capability-Based Programming and the Internet of Things (IoT), implementing the device identifier required by the (IoT), the list of implemented interfaces required by Capability-Based Programming, and a human-readable name, to act as a Business Key, for proper data modeling. With the Device interface, clients need not interact with any other exposed interfaces to know what device they are working with and what the device is capable of.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">The clients in this example may utilize static configuration or some service discovery mechanism, such as DNS-SD to discovery the Device interface endpoint and the means by which to connect to it. After connecting to the Device interface endpoint, the client then uses the list of supported capability interfaces, "Capabilities", to load and construct an Invocation Handler Proxy that can be used to execute the methods implemented by the interfaces exposed by the device. This example assumes that each capability interface is exposed through the same endpoint (URL, and/or Address & port) as the Device interface, such as is the case with Java RMI, and therefore a URL or other connectivity data is not required for each capability interface. If however this is not the case, a URL attribute may be added to the Capability class definition to add support for different interface endpoints, such as the case in SOAP-based Web Services.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">Using these techniques, new Capabilities can be added without impacting the interoperability of client applications. Additionally, any </span><span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;">client that understand how to work with a thermostat, a weather station, or both, can interoperate with the upgraded thermostat, not just </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">clients specific to that vendor's </span><span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;">device with the appropriate software update.</span><br />
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><span style="font-family: Times;"><br /></span></span>
<span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"><span style="font-family: Times;"><br /></span></span>
<b style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: x-small;">References:</b><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: xx-small;">1. Wikipedia.org: Proposed by Kevin Ashton in 2009, <a href="https://en.wikipedia.org/wiki/Internet_of_Things">The Internet of Things</a> refers to uniquely identifiable objects in an Internet-like structure.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: xx-small;">2. SMPTE.org: <a href="http://standards.smpte.org/search?fulltext=2071&smptes-status=in-force&submit=yes&content-group=smptes">SMPTE ST2071 Media & Device Control over Internet Protocol Networks</a>.</span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: xx-small;">3. OpenIdentityExchange.org: <a href="http://openidentityexchange.org/what-is-a-trust-framework">What is a Trust Framework</a>?</span>
<br />
<br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: xx-small;"><b>Special Thanks to Kai Kreuzer, Kenneth Melms, Theodore Szypulski, Rob Hunter, and the SMPTE for their help in the making of this article.</b></span><br />
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: xx-small;"><b><br /></b></span>
<span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif; font-size: xx-small;"><b>This article is available for modification and reuse under the terms of the Creative Commons Attribution-Sharealike 3.0 Uported License and the GNU Free Document License.</b></span>Steve Posickhttp://www.blogger.com/profile/12374968504765500674noreply@blogger.com1