# Defining a Reusable Primitive

A reusable primitive is a primitive that is intended to be included into multiple objects. This allows you to share component-level code across objects. The Input and Output primitives that you can add in the Object Designer are good examples of how reusable primitives are beneficial.

Using the ArchestrA Object Toolkit, you can create your own custom reusable primitives and use them in your objects. For more information on how to add a reusable primitive to an object, see Adding a Reusable Primitive.

From a development perspective, creating a reusable primitive is very similar to creating an object. Therefore, this section describes only the procedures that are specific to developing a primitive.

> **Note** 
> Reusable primitives must be added to an object before you can import them into a Galaxy. You can’t import a reusable primitive alone.

## Switching between Object/Primitive Mode

When working on an ArchestrA Object Toolkit project, you can switch between ApplicationObject and reusable primitive mode at any time. For example, when you start working on an ApplicationObject but decide that you want to implement its functionality as a reusable primitive instead, you can switch to primitive mode. If you later change your mind and decide that you do want to implement it as an object after all, you can simply switch back to object mode.

Any properties and features that are not relevant to the current mode are blocked from access in the Object Designer and Object Design View. However, they are still preserved in the project code, so when you switch back to the other mode, they are available again.

**To switch between object and primitive mode**

1. Open the Object Designer.
2. In the **Shape** pane, click the topmost node. The object properties appear in the **Configuration** pane.
3. In the **Category** list, select either **Application Object** or **Reusable Primitive**, depending on which mode you want.
4. Click **OK**.

## Differences Between Editing Objects and Primitives

When developing a reusable primitive, there are certain differences as compared to developing an ApplicationObject:

- The Object Designer doesn’t have any fields for editing the minor version, toolset name or description. These settings are irrelevant for a reusable primitive.
- The **Configuration Event Handlers** and **IDE Behavior** sections are removed from the Object Designer. Both are irrelevant for a reusable primitive. (The standard config time event handlers are still available via the Object Design View.)
- A reusable primitive does not have its own setting for “Advise Only Active” support. “Advise Only Active” support is determined by the ApplicationObject that the primitive is used in.
- Reusable primitives don’t have their own custom editor. Any required configuration UI must be implemented in the editor of the object that contains it.
- The **Build & Import**, **Build & Instantiate** and **Build & Deploy** build modes are not available. They are not applicable to a reusable primitive.
- The **Increment Minor Version** versioning option is not applicable to reusable primitives.
- The output file created by the build process is an .aaPRI file, not an .aaPDF file. You must add the reusable primitive to an object before you can import it into a Galaxy. You can’t import a reusable primitive alone.
