ASTRA in 5 minutes

ASTRA is a distributed/concurrent programming language based on the Agent-Oriented Programming (AOP) paradigm. AOP is quite similar to the Actor Model that is becoming increasingly popular within industry. The main difference between the two approaches is that actors are reactive (they only execute code on receipt of a message); whereas agents are pro-active (they are also able to execute code based on changes in their state). Both approaches tend to use message-passing as the primary means of interaction. However, for agents, the types of message that may be used is constrained to a limited set of message types whose meaning is clearly defined.

ASTRA itself is an event-driven programming language. State is modeled using Prolog-style logic programming constructs. Changes in state are modeled as events (the addition or deletion of facts) which are added to an event queue (a generalisation of the message queue of actors). Events in this queue are processed in FIFO order. Processing an event involves matching the event to an event handler (it is ignored if there are no matching event handlers). Event handlers are contextual and define a procedure that must be executed should the handler be matched to an event and an associated context be satisfied. The context what the state must look like in order for the handler to be matched. In some ways, this can be seen as equivalent to an overloaded method implementation where the signature of the method is the same, but there is an additional guard that is used to define when the particular implementation applies. When multiple handlers match an event, the order in which the rules appear in the source code is used to identify the chosen rule. Once selected, the procedure part of the rule is executed. Where multiple events are handled concurrently, procedure execution is interleaved.

In ASTRA, we use different terms to describe some of the above concepts: