Passing a custom class through a Tuple stream is generally frowned upon. It leads to the coupling of custom Operations to particular types, and it removes opportunities for reducing the amount of data that passes over the network.
The first objection can be overcome with a little work. When using
a custom type that has multiple instance fields, try to provide
Functions that can promote a value from the custom object to a position
in a Tuple, or demote the Tuple value for a particular field back into
the custom type. This lets you use existing operations like
RegexFilter to operate on values owned by a
For example, if you have a
create a Function named
GetPersonAge that takes
Person as an argument and returns just the age. The next operation can
then Filter all Persons based on their age. This may seem more difficult
and less effiicient, but it keeps your application flexible and avoids
duplicating existing operations. (The only alternative here is to create
PersonAgeFilter, which becomes one more thing
Copyright © 2007-2012 Concurrent, Inc. All Rights Reserved.