Version 6.3.8 for Windows
 —  Programming Guide  —

Introduction to NaturalX

This document contains a short introduction to component-based programming involving the use of the NaturalX interface and a dedicated set of Natural statements.

The following topics are covered:


Why NaturalX?

Software applications that are based on component architecture offer many advantages over traditional designs. These include the following:

Using NaturalX you can create component-based applications.

You can use NaturalX in conjunction with DCOM. This enables you to:

The following scenario illustrates how a company could exploit these advantages. A company introduces a new sales management system that is based on an application design using components. There are numerous data entry components in the application, one for each sales point. But all of these sales points use a common tax calculation component that runs on a server. If the tax legislation is changed, then only the tax component has to be updated instead of changing the data entry components at each site. In addition, the life of the programmers is made easier because they do not have to worry about network programming and the integration of components that are written in different languages.

Top of page

Programming Techniques

This section covers the following topics:

Object-Based Programming

NaturalX follows an object-based programming approach. Characteristic for this approach is the encapsulation of data structures with the corresponding functionality into classes. Encapsulation is a good basis for easy distribution. Because there are (quasi) standards for the interoperation of software components on the basis of object models, an object-based approach is also a good basis for making software components interoperable across program, machine and programming language boundaries.

Defining Classes

In an object-based application, each function is considered to be a service that is provided by an object. Each object belongs to a class. Clients use the services either to perform a business task or to build even more complex services and to provide these to other clients. Hence the basic step in creating an application with NaturalX is to define the classes that form the application. In many cases, the classes simply correspond to the real things that the application in question deals with, for example, bank accounts, aircraft, shipments etc. There is a wide range of good literature about object-oriented design, and a number of well-proven methods can be used to identify the classes in a given business.

The process of defining a class can be broadly broken down into the following steps:

These steps are described in more detail in the section Developing Object-Based Natural Applications.

Defining Interfaces

In order to be useful to clients, a class must provide services, which it does through interfaces. An interface is a collection of methods and properties. A method is a function that an object of the class can perform when requested by a client. A property is an attribute of an object that a client can retrieve or change. A client accesses the services by creating an object of the class and using the methods and properties of its interfaces.

The process of defining an interface can be broadly broken down into the following steps:

These steps are described in more detail in the section Developing Object-Based Natural Applications.

Simple classes only have one interface, but a class may have more than one interface. This possibility can be used to group methods and properties into one interface that belong to the same functional aspect of the class and to define different interfaces to handle other functional aspects. For example, an Employee class could have an interface Administration that contains all of the methods and properties of the administrative aspects of an employee. This interface could contain the properties Salary and Department and the method TransferToDepartment. Another interface Qualifications could contain the qualification aspects of an employee.

Interface Inheritance

Defining several interfaces for a class is the first step towards using interface inheritance, which is a more advanced method of designing classes and interfaces. This makes it possible to reuse the same interface definition in different classes. Assume that there is a class Manager, which is to be treated in the same way as the class Employee with respect to qualification, but which is to be handled differently as far as administration is concerned. This can be achieved by having the Qualification interface in both classes. This has the advantage that a client that uses the Qualification interface on a given object does not have to check explicitly whether the object represents an Employee or a Manager. It can simply use the same methods and properties without having to know of what class the object is. The properties or methods can even be implemented in a different way in both classes provided they are presented through the same interface definition.

The process of using interface inheritance can be broadly broken down into the following steps:

Top of page