## JSDAI Introduction

# Early and Late Binding

The terms early binding and late binding define how to operate on entitiy instances, their attributes and aggregates. While early binding operates on specific entity-types and attributes which are known during compile time, late binding works on arbitrary entity types and attributes, which are specified by parameters during runtime. Both binding modes need to know about the underlying express definitions. For early binding this is done by converting an EXPRESS schema into Java classes and interfaces. For late binding however the EXPRESS specifcation is converted into a population of the jsdai.dictionary package only.

J-SDAI supports in parallel both, early- and late-binding for application entities. Which one to use depends on the kind of problem to solve. Most applications are written for specific entity types. For all these applications programming in early binding is the proper choice, because it is simpler, more efficient and many errors can be detected at compile time because of strict type checking. Programming with late binding requires usually to work with dictionary instances and application instances in parallel. Programming in late binding it therefore more complicated and application programs get much longer. Its usage is therefore only recommended for applications which needs to work with arbitrary entity types.

The session entities SdaiSession, SdaiRepository, SdaiModel, SchemaInstance etc. in the jsdai.lang package are not treated as usual entities. Only the specified access and manipulation methods are available. Dictionary and mapping entities are usually only accessed by early binding - even if the late binding is also available (meta-meta level).

Please note that aggregates can never be assigned to an attribute, they can only be created in place. This ensures that aggregates are exclusively used by one attribute.

## Early Binding

For early binding access an EXPRESS entity xxx is represented by it's own Java interface `EXxx` and an implementing Java class `CXxx` and a Java class for aggregates of this entity `AXxx`. Access to an attribute aaa is performed by specialized methods `testAaa`, `getAaa`, `setAaa`, `createAaa`, `unsetAaa`. Which methods are available depends on the type of the attribute. For accessing the members of early binding aggregates AXxx specified early binding methods are defined.

For every attribute, either explicit, derived or inverse, a `getAaa` method is available. But only for explicit attributes the modification methods `unsetAaa` and `setAaa` are available. While `createAaa` method is used for attributes of type aggregate only.

## Late Binding

The interface `EEntity` and the class `AEntity` are the basis for late binding access to entities and aggregates thereof. For late binding entiy-instance-attribute and aggregate-member access specific methods for the Java types int, double and Object exist.

Copyright 1998-2000, LKSoftWare GmbH