Agents and Components

In languages like Java, Interfaces are expressions of pure design not implementation. Classes are units of implementation that implement Interfaces. Indus has done away with the requirement of a type that is explicitly known as an Interface. In fact, Agents and Components are both similar to Interfaces in that they are merely behavioral abstractions that Classes implement.

But there are important differences between Agents and Components as well. Agent members could be other agents, components, constants, fields and abstract methods whereas Components cannot have agents as members. Further, Components need to qualify abstract methods with ports that they represent. A port qualifies a method as a data producer or a data consumer or both as a data consumer and data producer.

In Indus, agent and component members cannot be classes unlike in Java. A class that implements an agent or component must implement all its methods including member methods, otherwise it is abstract. An Agent or Component may be declared to be a direct extension of one or more Agents and Components, meaning that it implicitly specifies all the member types, abstract methods and constants of its member Agents or Components, except for any member types and constants that it may hide.

A class may be declared to directly implement exactly one Agent or Component, meaning that any instance of the class implements all the abstract methods specified by the Agent or Component. A Class necessarily implements all the member Agents or Components and this (multiple) interface inheritance allows objects to support (multiple) common behaviors without sharing any implementation. A class can implement an Agent or Component and can extend another class at the same time.

Next : Agent and Component declarations