Monday, June 4, 2012

Best Practices for Coherence Portable Object Format (POF)



POF objects are indexed so it is possible to quickly traverse/navigate the binary (serialized form) to a specific element for extraction or updating using the indices without de-serializing the entire binary. Out of the box, coherence provides SimplePofPath class that can navigate a POF value based on integer indices. In the simplest form, all you need to do is to provide the index of the attribute that you want to extract/update. Some of the best practices that are coming to my mind are as under:
  • Order your reads and writes: start with the lowest index value in the serialization routine and finish with the highest. When deserializing a value, perform reads in the same order as writes.
  • Use the smallest possible integer for indexing the objects
  • Non-contiguous indexes are acceptable but must be read/written sequentially.
  • For subclasses reserve index ranges: index's are cumulative across derived types. As such, each derived type must be aware of the POF index range reserved by its super class.
  • Do not re-purpose indexes: to support Evolvable, it's imperative that indexes of attributes are not re-purposed across class revisions.
  • Label each of the index for the attribute
  • The most frequently used attribute in the Filter(s) and Extractor(s) should be assigned lowest index.
  • Enable POF Object  reference if the objects have circular/nested references (feature available in 3.7.1 + only)

No comments:

Search This Blog