IBM Streams 4.2.1
Best practices for developing applications
Use these tips to write operators that perform effectively in their application, and in other applications.
- Operator granularity
To design effective streams processing applications, operators need to be sized appropriately. Effective operators perform a single task. - Stream graph granularity
Design stream graphs with readability and reusability in mind, similar to the process you follow when you design operators. - Naming conventions
Following standardized naming practices improves program readability. - Stream punctuation
Punctuation marks are an in-band signals that are inserted between tuples in a stream. They indicate breaks in the data, which can be used by the operator logic. - Port mutability
When you define operator models while you develop a primitive operator, you must configure the mutability of tuples that flow through each input port and output port in the operator model. - Error handling
Operators might need to contend with errors in the form of erroneous input tuples, bad parameters, or unexpected values that are returned from functions. Recognizing errors is often easy. Error handling is more subtle and depends on where the error occurs. - Control ports
Control ports are operator input ports that receive tuples that update the internal operator state. These ports do not generate output tuples through submit() calls. Control ports are useful to dynamically control the behavior of the operator by changing a filtering condition, for example. - Output assignments
When you write a generic primitive operator, you can allow assignments to output tuple attributes through the output clause. Output assignments can be either plain assignments or assignments with custom output functions. - Default values for operator parameters
Operators that accept optional parameters at their invocation site must provide default values or require parameter to be provided. Choose default values that are safe, that do not adversely affect performance, and that follow the principle of least surprise. - Window support
When you write a primitive operator, you might need to maintain a set of recently processed input tuples to compute the operator output. It might be sufficient to use Streams Processing Language (SPL) support for windows. - Documenting operators and toolkits
When you develop an operator, a composite operator, or a toolkit for third-party use, you must document its functionality, expected inputs, and generated outputs. - Creating application configuration objects to securely store data
You can use application configuration objects to securely store configuration data for your IBM Streams environment.
Parent topic: Writing streams processing applications