NCSAHabanero

[ Previous ] [ Index ] [ Next ]

-------------------------------------------------------------------
How to decide which variables to send to other hablets
-------------------------------------------------------------------

Variable serialization decision

Background Information

When you transfer state to other instances of the client, you usually do not want to transfer all the variables. If you do, you may waste time transferring variables that never change.

This pattern helps you decide which variables to serialize for transferring.

How does this work?

Normally, you serialize all the variables that change during the use of the hablet. Because you serialize only the variables that change, you would not normally transfer variables containing immutable widgets like menus and buttons, but you would transfer variables containing fields.

Sometimes you might not want to serialize some fields because they are input fields, and you want to serialize only output fields. For example, in the Running Example, outArea is serialized but not inArea.

If your hablet has variables that contain some internal state of the hablet, you should serialize those variables so that new clients can duplicate that internal state. For example, a hablet that uses a neural net would have to share the current state of the neural net with new clients so that they will react in the same way to the next user input.

These decisions are simple to make in a simple hablet like the Running Example, but with a more complicated hablet, the best solution might not be at first clear. An easy way to deal with this problem is to start off by serializing any variable that you are think might need to be serialized, and then to trim them down later if the hablet is too slow. In general, the main problem with a hablet that serializes too many variables is that it will be too slow.

What next?

How to transfer the variables, now that you have decided which ones to transfer.


Habanero® is a registered trademark owned by The Board of Trustees of the University of Illinois. Copyright 1996-1998. All rights reserved.   Java(TM) is a proprietary trademark owned by Sun Microsystems, Inc. NCSA
The National Center for Supercomputing Applications

University of Illinois at Urbana-Champaign

Contacts page