Best Practices
Writing a good node requires a good understanding of the Openexus platform and how to best leverage it to create a node that is both functional and easy to use. Here are some best practices to keep in mind when writing your own node:
- Create a good manifest.
- Define meaningful properties.
- Write clean and efficient code.
- Use the Openexus API effectively.
- Test your node thoroughly.
- Document your node.
- Follow the Openexus style guide.
Create a good manifest
The manifest is the first thing that users will see when they interact with your node. It should be clear, concise, and informative. Here are some tips for creating a good manifest:
- Use a clear and descriptive
name
for your node. - Write a
description
of what your node does and how it can be used. - Include at least one
category
for your node. (See Categories for more information.) - Provide at least one keyword in the
keywords
field for your node. Even more keywords are even better.
Define meaningful properties
Properties are the inputs and outputs of your node. They should be well-defined and easy to understand. Here are some tips for defining meaningful properties:
- Use clear and descriptive keys for your properties. Note that keys may only include A-Z, 0-9, or underscores. No spaces or dashes or other characters are allowed.
- Use appropriate datatypes for your properties. (Please see Datatypes for more information.)
- Provide default values for your properties when appropriate.
- Use the
description
field to provide additional information about each property. - Use the
required
field to indicate whether a property is required or optional. - Add
documentation
to your properties to provide additional information about how to use them and about any special considerations.
Write clean and efficient code
The code that powers your node should be clean, efficient, and easy to understand. Here are some tips for writing clean and efficient code:
- Use clear and descriptive variable names.
- Use comments to explain complex logic.
- Use functions to break up complex logic into smaller, more manageable pieces.
- Avoid using global variables whenever possible.
- Use the Openexus API to access properties and other information about your node at runtime.
Use the Openexus API effectively
The Openexus API provides a powerful set of tools for building nodes. Here are some tips for using the Openexus API effectively:
- Familiarize yourself with the Openexus API documentation.
- Use the Openexus API to access properties and other information about your node at runtime.
Test your node thoroughly
Testing is an essential part of the development process. Here are some tips for testing your node thoroughly:
- Test your node with a variety of inputs to ensure that it handles edge cases correctly.
- Test your node in different environments to ensure that it works as expected.
Document your node
Documentation is an essential part of the development process. Here are some tips for documenting your node:
- Write clear and concise
documentation
for your node. - Write clear and concise
documentation
for each property. - Include any relevant links to external resources.