Thing Shapes
Thing Shapes provide a set of characteristics represented as properties, services, events, and subscriptions that are shared across a group of physical assets. A Thing Shape is best used for composition to describe relationships between objects in your model. They promote reuse of contained properties and business logic that can be inherited by one or more Thing Templates. In ThingWorx, the model allows a Thing Template to implement one or more Thing Shapes, which is similar to a class definition in C++ that has multiple inheritance. You can override business logic in the inherited services from the Thing Shape if you explicitly define the service to allow override in the parent object definition. When you make a change to the Thing Shape, the change is propagated to the Thing Templates and Things that implement that Thing Shape; so, maintaining the model is quick and easy.
A use case for a Thing Shape is if you have multiple product lines using the same ERP system. For example, a company has two business units: one makes residential lawn tractors and the other makes commercial agricultural equipment. The lawn tractors and agricultural equipment do not have common data or behaviors. However, they are both ERP assets that can be tracked. Both have information on the customer and service ticket system in the same CRM system. To implement these interfaces as a physical asset only once, you can insert business logic in a Thing Shape. For example, you can implement a way to get relevant data from an ERP system into an ERP Connector Thing, which is represented as a Thing Shape. The ERP Connector Thing can have configuration data that knows how to reach the ERP system (for example, an IP address), how to authenticate against it (for example, using a technical user), and how to handle request responses. You should implement the request response functionality using services in the ERP Connector Thing. Then you can define specific functions to get request data from a Thing Shape for the application. The Thing Shape should have basic data represented as properties (such as Location and ERP Asset ID), services that get asset specific data (such as Get My Open Work Orders, Get My Work Order History, and Get My Customer Entitlements). Then, Thing Templates for both lawn tractors and agricultural equipment can inherit capabilities from the Thing Shape and have access to ERP data through the encapsulated business logic in the Thing Shape.
Good descriptions not only help when browsing objects, they also contribute to the overall system ability to do searches across text fields when you are trying to locate an item or groups of items. This applies to all entity types.
Creating Thing Shapes with an Extension
Thing Shapes created with an extension are basically the same as those created in ThingWorx Composer. They are base templates that are used to create Things with the same properties, configuration parameters, services, and so forth. The difference between creating them in Composer and inside an extension framework is the language used for the services and visibility of those services.
Composer Template:
Uses JavaScript for services
Source code is visible
Extension SDK Template:
Uses Java for services
Source code is not visible