Chapter 1

Introducing Telescript

Computing today is a fabric of networks, a huge crochet of interconnected computer processes exchanging information. That crochet can be, as often as not, a tangle of confusion and inefficiency. Computer users attempting business on the net are up against a multitude of different platforms, transmission protocols, character sets, and other components of network technology. If they make it past these barriers through the graces of a competent network browser, they're still up against the fact that useful information and transaction opportunities are spread throughout the net. Users often have to spend a substantial amount of time at the controls of a browser, traipsing from site to site, looking for relevant information.

Telescript® technology gives the computer user the chance to use agents to do their network traipsing for them while they disconnect from the net and go about other business. An agent is a self-contained program that can travel from location to location on the net. It looks for information and transacts business for the user, and can return to the user when it's finished to report on its success or failure and then deliver any requested information.

A user can, for example, log into a network access service and turn loose an agent to look up local concert dates for the St. Paul Chamber Orchestra and then buy tickets from an online ticket service if the dates are acceptable. The user, after submitting the request to an agent, logs off to enjoy a hike in the hills while the agent performs its network footwork. After the hike, the user logs on again to get an email message from the agent that reports on dates and tickets bought or not bought.

Telescript technology gives programmers the ability to provide network agent technology in their programs or web sites. The Telescript language is a rich networking language that can be used as a network-programming adjunct to other languages such as C or C++, much as the PostScript® language is used as a print- and display-programming adjunct to programs.

Because the Telescript language is designed for networking, it simplifies network programming by handling network transmission protocols in a way that's transparent to the programmer. Its agent technology allows you to get the best results from network transactions with the least use of network resources, an especially important consideration if your program must deal with slow network transmission rates. Telescript technology turns the network into a single platform in which your program can do its work.

The Telescript language is object-oriented to provide the extensibility of classes and objects (described later in this book). The Telescript classes allow you to easily create new programs by building on your earlier work. And Telescript's objects allow you to create your programs using real-world models.

In this chapter, we take a first look at Telescript technology: what it is, how it does its work, and how it can help you create better web pages and networking applications.

What Is Telescript Technology?

Telescript technology is computing technology built around the Telescript language. It consists of:

A typical Telescript programmer can safely ignore the underlying components of Telescript technology and concentrate on the core of that technology: the Telescript language.

What Is the Telescript Language?

In one sentence, the Telescript Language is a remote-programming object-oriented networking language. A real mouthful, to be sure, but it makes more sense when you break it down into individual components. At the root of the definition is the fact that Telescript is a full-fledged language: it has a well-defined syntax; it provides conditional statements, primitives, and other important programming mechanisms; it is compiled and interpreted; you work with it as you do any standard computing language. What distinguishes Telescript from those other languages are the adjectives "remote-programming" and "object-oriented" that come before the noun "language."

Telescript Is an Object-Oriented Language

As an object-oriented language, Telescript joins the ranks of other object-oriented languages such as C++. Everything created using the Telescript language is an object--a single programmed entity that contains both data and the procedures that work with that data. An object's data and procedures determine the object's behavior.

Objects range from the simple (an integer, for example) to the complex (an agent, for example). You can combine two or more objects to create a more complex object. And once you create objects in a Telescript program, Telescript technology provides mechanisms that allow the objects to interact with each other.

Telescript objects are all defined by classes. Creating an object is a simple matter of asking for an instance of a class--a convention that means you don't have to define each object anew as you create it, but simply base each object on the blueprint already provided by a class. You can define new classes by adding to the specifications already provided by existing classes. This makes Telescript an extensible language: you can customize it to create types of objects that fit precisely the tasks you're trying to accomplish.

Telescript's object-oriented nature fits its networking environment well. Because each object encapsulates its data--that is, it prohibits another object from directly reading or writing its data--Telescript binds data and action into discrete units that help enforce security and privacy in the Telescript environment.

If the whole concept of an object-oriented language sounds a little confusing to you now, the next chapter explains it in much more detail and gives you the specifics of Telescript's object-oriented nature.

Telescript Is a Networking Language

Telescript is a language strictly designed for network transactions, much as a language like PostScript is strictly designed to describe screens and printed pages. Telescript does not include mechanisms to support a graphical user interface, powerful number crunching, or other features that are better addressed in other languages and programming environments. You won't use Telescript to create a dynamite word processor, manage a data base, or usher in a revolution in multimedia. You will use it to help create an electronic marketplace where computer users can easily work, play, and buy services on the network.

Telescript is not a low-level networking language. It doesn't concern itself with the mechanics of how information is sent from place to place over the network--you won't use it to send packets through a router or determine an IP address. Telescript focuses instead on high-level network interactions: how one self-executing program (called a process) can exchange information with another process.

When an agent (a traveling process) travels in the Telescript environment, Telescript provides built-in security that ensures that the agent can't take actions harmful to the system and resources of another process. It protects data privacy and it limits actions of a visiting agent to those actons that are granted by permission of a location's owner. To help determine billing for services rendered and to prohibit excessive use of resources, Telescript provides a mechanism that monitors a process's resource use. And Telescript provides a mechanism that can efficiently broadcast information simultaneously to a large number of processes instead of depending on individual process-to-process information exchanges.

The Telescript language is not meant to be a standalone environment. It's designed to provide an efficient tool for carrying out network transactions within an application. A stock-market-monitoring application may, for example, be written in C to display market information on a computer monitor, accept user commands, and store data on a hard disk. When it needs to check stock prices on the network, however, it uses the Telescript language to create processes that carry out its orders on the network. This is much the way that the PostScript language is used within an application to carry out a printing or page-display task. In both cases, the work the language does is invisible to the end user, but it greatly enhances the end results.

Telescript Supports Remote Programming

The most revolutionary aspect of the Telescript language is that it supports remote programming. To understand remote programming, it helps to look at how network transactions are typically accomplished: through remote procedure calls (RPC). In the RPC model, a client process running in one location on the network uses a remote resource provided by a server process in a second location. The client process sends procedure calls to that server. The server responds to each call and sends a result back to the client so the client can examine the result and decide on the next resource call.

As an example of RPC, consider a mailing list client that wants to delete delinquent subscribers from a mailing list stored by a server. It calls once to retrieve a list of subscribers and their last recorded subscription payment. It determines which are at least two months overdue with payment, and then calls once to delete each overdue subscriber from the server's mailing list.

This back and forth exchange of call and result (shown in Figure 1-1) continues over the network until the client is finished with its business. If there are 2000 delinquent subscribers, the client must make 2001 procedure calls to delete those subscribers. This transaction requires extensive use of network communications, and--if the connections are slow--is considerably bogged down by the connection speed.

Figure 1-1 : A procedure using remote procedure calls to work with a remote resource uses many network communications to accomplish a single job.

Remote programming, provided by Telescript technology, gets rid of the back-and-forth nature of remote procedure calls by sending the client process itself--not its procedure calls--to the server location as an agent. Once there, the agent can perform the same transactions with the server (as shown in Figure 1-2) without using network connections. The number of network communications is cut to a fraction of those used for the same work accomplished by RPC. To accomplish the same task described in the previous example, the transaction requires a single communication: sending the process to the server. Compare that to the 2001 communications necessary for the same work accomplished by RPC, and you can see that remote programming saves network use and time--especially if network connections are slow.

Figure 1-2 : A procedure using remote programming to work with a remote resource need use only a single network communication to accomplish the same job.

Travel During Execution

It's important to realize that Telescript allows an agent to travel from one location to another during its execution, not just before or after its execution. When an agent travels, it starts execution in one location, is transported to another location where it continues execution, and may be transported to many more locations for further execution in each of those locations before it finishes execution. Compare this to a language like Java that allows a process to be transported to a new location only before execution begins. Once a Java process executes, it is bound to its location. A Telescript agent's ability to travel during execution binds together work at multiple locations throughout the Telescript environment. It provides end results that are gleaned from throughout the network.

Telescript Concepts

Now that you have an overall impression of the Telescript language, let's look at some specifics--the conceptual components of the Telescript environment.

The Telescript Engine

At the heart of Telescript technology is the Telescript engine. A Telescript engine dynamically executes Telescript code, whether it's code entered at the site of the engine or it's the code of a visiting agent. An engine is the sole environment where a Telescript process may execute--Telescript processes cannot execute in any other environment.

A Telescript engine can run on any number of different platforms--different flavors of UNIX workstations, for example. A single computer can run more then one Telescript engine if desired (and if the computer supports multitasking). Each engine uses the computer's underlying operating system, hardware, and network connections for its work, but makes their use completely transparent to any Telescript processes executing on the engine. An agent that asks its host engine to send it to a new location, for example, has no idea how the engine will transport it there. It simply knows that the engine will execute the transport whether it has to use a modem, an Ethernet connection, or any other connection technology.

All Telescript code executed on an engine is interpreted. The engine accepts each element of code (called a token) and, when it interprets the token, carries out the action the token specifies. The engine uses whatever platform resources are necessary to carry out that action. Because Telescript code is interpreted, a Telescript process never has direct access to any of the platform's physical resources. Any work it does must go through the engine, which provides a substantial level of security to the underlying resources of any computer that hosts Telescript processes on an engine.

A Telescript engine provides preemptive multitasking--it can, and usually does, run many processes simultaneously. To ensure that those processes won't die an unnatural death if the platform or the engine crashes, the engine constantly backs up its state, which includes the state of all running processes. When an engine is restarted after a crash, it restarts each saved process at its last saved state. This feature is called persistence, a safeguard that ensures that an agent or any other process won't simply disappear without a trace on its travels around the Telescript universe.

The Telesphere

Telescript is a networking language. It performs its best work when it's used with at least two connected Telescript engines. Two or more connected Telescript engines form a telesphere, a universe of locations that Telescript agents may traverse. Although a telesphere may be as small as two engines, it typically numbers many thousands of engines and--as connections between Telescript engines grow--encompasses a global network. It's useful to look at the telesphere through the perspective of an agent: it's the sum of the locations where that agent may travel.

High Telescript and Low Telescript

When you write a Telescript program, it goes through several steps from its birth at your hands to its execution at the hands of a Telescript engine. When you write, you use a form of the Telescript language called High Telescript (HTS for short). The program you write is called a script. Your HTS script is compiled by a Telescript compiler that produces a more fundamental form of Telescript called Low Telescript (LTS for short). The compiled LTS code is submitted to the Telescript engine, which executes the program, performing specified actions and creating objects as required.

Figure 1-3 shows a very simple view of the steps it takes to write and execute a program in the Telescript language. The figure assumes a perfect world, neatly avoiding bothersome programming details such as linking, debugging, and managing source code files.

Figure 1-3 : An HTS script is compiled into LTS code which is interpreted by a Telescript engine.

High Telescript is a compiled language; Low Telescript is interpreted. An HTS script cannot be directly interpreted by a Telescript engine. It must first pass through a Telescript compiler that turns it into LTS code. LTS code is interpreted directly by the Telescript engine.

Low Telescript is completely transparent to Telescript programmers, an intermediate step created by the compiler and read by the Telescript engine. There's no need for Telescript programmers to program directly in Low Telescript. It may, in fact, be risky to write code in LTS because the syntax and structure of Low Telescript may change from release to release with no notification to Telescript programmers.

Because Low Telescript is strictly the affair of compiler and engine, this book describes Telescript solely through the syntax of High Telescript. Whenever you read the word "Telescript" here, you can safely assume that it means High Telescript. If this book discusses Low Telescript, it calls it directly by name or by its acronym LTS.

(Note that in the current release of Telescript, HTS does not yet completely cover all the features of LTS. There are rare occasions when you'll have to add sections of LTS code to an HTS script to get precisely the results you want. This book will point out those occasions.)

Telescript Processes

Processes are the spark of life in the Telescript world. Each process is an object that is born, lives, and dies. While a process lives, it executes and acts of its own volition--or at least the volition of the person who programmed it. It can initiate actions with other objects in the Telescript environment. Objects that are not processes act only when requested, and cease execution as soon as the requested action is finished.

Each Telescript process has a telename. That telename is an integral part of the process, and can't be changed or deleted by the process. The telename includes an authority for the process. The authority identifies the individual or organization for whom the process executes. For example, an agent process might execute under the authority of Ozo Benton while collecting stock prices from various locations in the telesphere. That authority is part of the agent's telename, and is visible to any other object with which it interacts. Authority ensures that a process can't misrepresent itself to other objects. Ozo Benton's agent will never be able to pretend that it's running under the authority of Dow Jones to get restricted stock information from a Dow Jones server.

One process may interact with another process when they are in the same location, exchanging information and requesting actions of each other. The Telescript engine imposes strict rules on the way two processes interact. Processes can interact only if both processes agree to the interaction. One process can't ask a second process to do something that the first process isn't authorized to do.

The Telescript language defines two kinds of processes: places and agents.

Places

A place is a stationary process--it can't travel like an agent can. It resides within a Telescript engine, and has a unique teleaddress. A teleaddress contains an authority that it can neither delete nor change (just as a telename does), so each place truthfully identifies the individual or organization for whom it works. A teleaddress may also contain a location and routing advice so that agents can find the place.

A place can contain other processes--agents or other places. When one place contains other places, those places are said to be nested within the first place. Nested places can have more places nested within themselves, so it's possible to have places within places within places and so on into an infinite number of places (limited by the computing resources available to support those places, of course). Figure 1-4 shows an example of nested places.

Figure 1-4 : One place can contain other places nested within. Any one of those places can contain agents. (The rectangles in the figure are places; the circles are agents.)

Every Telescript engine contains an engine place. The engine place is the outermost place on an engine: it contains all other places that run on that engine. Each engine has only one engine place.

The location of a process (the place it occupies) determines what other processes it can work with. Two agents can't work with each other unless they both occupy the same place. An agent can't work with a place unless it occupies that place directly. And a place can only work with the place it occupies.

The mechanism of place segregates process interactions into distinct arenas of activity. This is a convenient way to let an agent choose the type of activities it wants to indulge in. If an agent wants to buy tickets to a concert, it goes to a ticket-selling place. If it wants to negotiate used car prices with other agents, it goes to a used-car-market place.

Agents

An agent, as you read earlier, is a process that can travel from place to place and do work at each place. That's not to say that an agent must travel; some agents are born, live, and die entirely in one place. Travel for an agent, just as for some humans, depends on where business takes it.

When an agent travels, it uses a ticket, an object that specifies a destination place. A ticket contains the place's teleaddress (among other information) and recommends ways to get to that place. The agent uses its go operation (every agent has a go operation) to tell the engine that it wants transport to the place specified by the ticket. The engine suspends the agent's execution and saves the agent's state. If the agent is going to a destination place that isn't on the same engine, the engine encodes the agent for network transmission. The engine then uses the best means available to transmit the agent to its destination place.

When the traveling agent arrives at its destination place, the engine there decodes the agent and presents it to its intended destination place. If the agent doesn't have the proper credentials (its authority isn't accepted, for example), the place can refuse entry. If the agent is accepted, it resumes execution within the destination place. Execution resumes from the state that was saved before traveling, so the net effect for the agent is of going to sleep in one place and awakening in a new place.

Every process (both agent and place) has a permit that delimits the process's life and actions. The permit states the maximum length of the process's life, the amount of computing resources it can use, possible actions it can take, and so forth. When an agent enters a place, the place can put further restrictions on the agent's permit while the agent is in that place so the agent can't perform actions that the place doesn't want performed.

When an agent enters a place, it can meet with other agents occupying that place. A meeting between two agents starts with one agent preparing a petition, an object that specifies a second agent by telename, by class, or by both telename and class. The agent presents the petition to the place. The place looks for an agent that matches the petition's requirements, and--if it finds a match--notifies the found agent that another agent requests a meeting. If the second agent agrees to the meeting, the place puts the two agents in touch, and they can then work directly with each other, exchanging data and requesting actions. Agents can, of course, decline a petition, so agents can only meet and work with each other if both agents desire the meeting.

Creating an Electronic Marketplace

Telescript developers can use Telescript's agents and places to create an electronic marketplace. An individual or an organization can create one or more places under their authority to do business with other processes in the telesphere. Those places can all run on one engine, or may be spread out over many engines; they still function under the same authority, regardless of location. The complete group of locations under a single authority is called a region.

A place set up for business typically creates one or more resident agents to do business, agents that don't leave the place where they were created. These agents are there to meet with visiting agents and transact different aspects of business. Having more than one resident agent per place allows a business to segregate different types of transactions. In a real-estate place, for example, one resident agent may supply the names of mortgage brokers, another resident agent may provide a listing of houses in a specified area and price range, and another agent may make appointments for visits to selling houses.

Many resident agents in a single place also provide concurrency. Because the resident agents can execute in parallel, they can handle many more visiting agents at a time than a single place can--the Telescript equivalent of having more cashiers at the supermarket.

A place doesn't have to have a resident agent to do business; visiting agents can work directly with the place if the place is set up to do so.

An Example

To see how Telescript places and agents can be used to do business, let's look at a more involved example.

A genealogy firm decides to set up a web page where users can ask for genealogical research. Clients connect to the page using a web browser, which exchanges information with the page server using HTTP. The web page presents buttons and fields with which the client can work to request a service: searching for the birth records of an ancestor, checking lineage for a particular branch of a family, and so forth. This is not information that the genealogy firm has on hand, so the client won't get immediate results from the server. Instead, the request information they've left is used to start a genealogical search that--thanks to Telescript technology--continues to work after the client has disconnected from the web page.

Underlying the web page is a Telescript engine where agents and places can live. Once a client makes a research request, the server creates an agent of the client's authority that stays at work in the engine after the client has disconnected. The agent first goes to work on information that the server already has, and may then use remote resources to finish its work.

Say, for example, that a client--one Kevin Backe--asks for the genealogy of his unmarried maternal aunt, a woman named Vrinda O'Malley. He enters her name and birth statistics using the controls on the web page. His agent first checks information on the server about the aunt's surname and finds three different genealogical archives where that surname will most likely be found. One archive, in Des Moines, has a genealogical database attached to a Telescript engine; that archive is in the agent's telesphere. The second archive, in New York City, is on the net but it isn't attached to a Telescript engine; it presents its archived information through an HTTP process. The third archive, in the parish records of a small Irish town, isn't even on the net; a human has to call the archive by phone to have an archivist page through birth records there and report what they can find.

Kevin's agent handles each of these archives in a different way. For the Telescript-enabled archive, the agent creates a second agent that also acts under Kevin's authority. That agent travels to the archive place in Des Moines, where it uses public operations to request to see records that might relate to Vrinda O'Malley. The place retrieves what it was asked for. The travelling agent looks through the returned records to sift out pertinent records, and asks for more records if necessary. Once it's finished with its search, it returns to its origin, where it meets with Kevin's primary agent and gives it the Des Moines records. The primary agent puts that information into an email message that it sends to Kevin.

For the archive in New York City that's on the net but isn't Telescript-enabled, Kevin's primary agent establishes an http connection to the archive so it can search through the html text there for pertinent information. Because the genealogical firm uses this archive often, it has customized agents that can work directly with the New York City archive's web page, using controls there to search for the desired information. The client's agent does so, and retrieves more information about Vrinda O'Malley. It puts the information into a second email message that it sends back to Kevin.

For the archive in Ireland, the agent knows that it needs human intervention. It generates an email message to a research specialist at the genealogy firm. It then puts itself to sleep while it waits for results. (This avoids using computing resources while waiting around.) The specialist, diligently checking her email, receives the agent's request along with the phone number and person to contact at the Irish archive. She calls and asks for records. The Irish clerk, a day later, calls back with more information about the Vrinda O'Malley family line. The specialist then enters that information in her computer, asking the Telescript engine to awaken Kevin's agent and present it with the information. The agent sends the information, once again via email, to the client. Because this message completes the work requested by the client, it also includes a list of the work accomplished by the firm and the amount charged to the client's credit card. That amount is established, in part, by work records maintained by Kevin's agent.

As you can see in this example, Telescript is flexible enough to handle a wide range of network resources, low-tech or high-tech. A user can take advantage of Telescript technology through a variety of sources, in this case a common web page. When resources are available in the telesphere, agents can travel to use them directly. When resources aren't available in the telesphere, a process can reach outside the Telescript environment (through net connections and mechanisms provided by the engine) to use them.

Telescript agents offer more advantages than simple mobility. Once launched on their business, they act on their own volition in the interest of their user, even when the user has switched off his computer. Agents can sleep while waiting for results, so they don't overtax computer resources. Because Telescript is an object-oriented language, agents can be customized to the work at hand--in this example, the agents were customized to handle the protocol of a non-Telescript-enabled remote resource.

The Greater World of Telescript Technology

There is more to Telescript technology than the Telescript language, of course. There is the full set of underlying mechanisms that support Telescript--Telescript engines, platform-specific APIs, encoding protocols, and so on. These are parts of the technology that most programmers need not know about. There is also a full set of programming tools--compiler, debugger, tools to integrate Telescript with the World Wide Web, and more--and libraries of Telescript classes that extend the capabilities of the Telescript language to perform specialized tasks. You can read about the Telescript programming tools and class libraries in the documentation that accompanies them.

This book concentrates strictly on the Telescript language--High Telescript syntax, the classes that come with the language, and the concepts you'll need to work successfully with both of these components. The classes that are directly defined by the Telescript language are called built-in classes. (Any classes derived from these built-in classes--library classes, for example, or classes that you might create yourself--are called custom classes.) You'll see in this book just how Telescript's built-in classes work together. But first, you need to know more about classes and how they're defined in the Telescript language. And for that, you need to turn the page and start reading the next chapter.

1 - Introducing Telescript
What Is Telescript Technology?
What Is the Telescript Language?
Telescript Is an Object-Oriented Language
Telescript Is a Networking Language
Telescript Supports Remote Programming
Travel During Execution
Telescript Concepts
The Telescript Engine
The Telesphere
High Telescript and Low Telescript
Telescript Processes
Places
Agents
Creating an Electronic Marketplace
An Example
The Greater World of Telescript Technology

TS Ref - 26 JUN 1996

Generated with Harlequin WebMaker