Warning:
This wiki has been archived and is now read-only.

InterfaceDescriptionLanguage

From Device Description Working Group Wiki
Jump to: navigation, search

List of IDL Resources

Introduction

IDL (Interface Definition Language) is a declarative language used to define the interfaces that objects expose to the public (so that client objects can call them).

What is an interface?

In object-oriented programming languages, objects define their interaction with the outside world through the methods that they expose. Those methods form the object's interface with the outside world; for example, the buttons on the front of your television set are the interface between you and the electrical wiring on the other side of its plastic casing, so you can press the "power" button to turn the television on and off.

In its most common form, an interface is a group of related methods with empty bodies. A bicycle's behavior, if specified as an interface, might appear as follows:


interface Bicycle {

       void changeCadence(int newValue);

       void changeGear(int newValue);

       void speedUp(int increment);

       void applyBrakes(int decrement);
}

To implement this interface, the name of the class would change (to ACMEBicycle, for example), and the implements keyword would be used in the class declaration:


class ACMEBicycle implements Bicycle {

   // remainder of this class implemented as before

}

Implementing an interface allows a class to become more formal about the behavior it promises to provide. Interfaces form a contract between the class and the outside world, and this contract is enforced at build time by the compiler. If your class claims to implement an interface, all methods defined by that interface must appear in its source code before the class will successfully compile.

An interface definition completely defines the interface of an object and fully specifies each operation’s parameters. Interfaces help providing the information needed to develop clients that use the interface’s operations.

IDL, interfaces and implementations

It is important to note that IDL is a declarative language. This means that neither objects implementing interfaces specified in IDL nor client objects implementing the functionality to access those interfaces are programmed in IDL. Once again, IDL only describes the way in which an object can communicate with other objects, also providing this way the information needed to develop clients that use the operations exposed by the interface.

The implementation of the interfaces of an object and the implementation of client objects meant to call the operations exposed by those interfaces is achieved by developing them in a programming language for which mappings from IDL have been defined. The mapping of an IDL concept to a client language construct will depend on the facilities available in the client language. For example, an IDL exception might be mapped to a structure in a language that has no notion of exception, or to an exception in a language that does.

Mappings of IDL concepts to several programming languages are available in the official OMG Catalog of OMG IDL / Language Mappings Specifications .

IDL flavours

In previous references in this wiki page, IDL and OMG IDL has been mentioned. The reason for this is that there is more than one “flavour” of IDL.

  • OMG IDL, created by the Object Management Group as part of their CORBA standard. OMG IDL is intended to generate mappings of defined interfaces to several programming languages by using IDL compilers. It helps generating skeleton implementations for objects implementing the interface and for client objects consuming the methods exposed by interface implementors.
  • MIDL (Microsoft Interface Definition Language) is an interface definition language tightly coupled to Microsoft’s COM technology. MIDL Compiler is part of Windows Platform SDK and mapping languages are C/C++. There are some proprietary products trying to extend MIDL and COM to other platforms.
  • XPIDL is Mozilla's interface definition language, based on OMG IDL (and using Gnome's IDL compiler library libIDL) with support for XPCOM, a cross platform component object model.

More text to be added here.

IDL and W3C

WebCGM

Web API WG

The Web API working group is also using IDL to specify the interface for XmlHttpRequest object. The group declares to not be using OMG IDL and are using their own flavour:

They are also using IDL in some other working drafts: Window Object 1.0, DOM Level 3 Events Specification

!Currently there is an ongoing discussion in the DDWG public list about how to face the creation of the IDL interfaces for the DDR API, how to map them to different languages and the possible need to modify the automatically-generated language mappings. The two starting messages for this topics are 1 and 2.

* Most of the W3C Recommendations using IDL have used Spec Generator, an internal tool developed to create a Recommendation document including IDL and mappings to other languages.

DDWG and IDL

! Tentatively the Device Description Working Group will try to use the Spec Generator as the tool to generate the API Recommendation including IDL and bindings to other languages.

Tools

IDL Editors

IDL Compilers

* W3C Spec Generator

Tutorials

IDL To Java with the idlj compiler

OMG IDL Getting Started

References

DDWG wiki IDL references