Best Practices for Creating Reusable Components
Use the following best practices while creating reusable components.
Packaging of Components
Individual components are packaged as extensions. Based on the business decision, a combination of components is further bundled as extensions.
Dependency of Components
Package the components into bundles for each release. The component dependency is managed through the bundle (extension) dependency. See the section Dependencies, for more information about extension dependencies.
Based on the business logic the components are packaged together as extensions. These extensions are licensed.
Creating Non-Editable Components
It is recommended to create components that are non-editable. Non-editable components are easy to upgrade. However, ensure that the component can be configured. Expose parameters that will help users to customize the component to suit their requirements. Define if a parameter of the reusable component is visible to the user. You can set the default values for the parameters. users should be able to customize the component by changing its internal code.
The API functions of the component should not be removed or modified to ensure error-free component upgrades.
Creating Components Using Thing Shapes
It is recommended to use Thing Shapes while creating components.
Properties and services should be implemented on a Thing Shape and not on Thing Templates and Things, whenever possible.
Use a Thing Template to group Thing Shapes. This supports inheritance.
The services on Thing Shapes and Thing Templates should allow an override.
The out-of-the-box Thing Shapes and Thing Templates should be non-editable.
Extending and Customizing a Component
Use the following best practices when you extend or customize a component:
1. Create new Thing Templates that inherit the out-of-the-box Thing Templates.
2. Override the services and properties in the new Thing Template.
3. Create a new Thing.
4. Introduce new services and properties in the new Thing.
Was this helpful?