Skip to main content

Overview of Packages

Overview of Packages

InterSystems IRIS supports packages, which group related classes within a specific database. Packages provide the following benefits:

  • They give developers an easier way to build larger applications and to share code with one another.

  • They make it easier to avoid name conflicts between classes.

  • They give a logical way to represent SQL schemas within the object dictionary in a clean, simple way: A package corresponds to a schema.

A package is simply a way to group related classes under a common name. For example, an application could have an Accounting system and an Inventory system. The classes that make up these applications could be organized into an Accounting package and an Inventory package:

The Accounting package has classes called Invoice and Item. The Inventory package has classes called Warehouse and Item.

Any of these classes can be referred to using their full name (which consists of package and class name):

 Do ##class(Accounting.Invoice).Method()
 Do ##class(Inventory.Item).Method()

If the package name can be determined from context (see below), then the package name can be omitted:

 Do ##class(Invoice).Method()

As with classes, a package definition exists within an InterSystems IRIS database. For information on mapping a package from a database to a namespace, see Package Mapping.

FeedbackOpens in a new tab