DDS-Java 1.0b2 FTF Avatar
  1. OMG Issue

DDSJAVA — Improve usability of “bucket” accessors

  • Key: DDSJAVA-6
  • Legacy Issue Number: 16316
  • Status: closed  
  • Source: DECA ( Rick Warren)
  • Summary:

    The third bullet at the end of section 7.1.5, “Method Signature Conventions”, reads:

    · Accessors for properties that are of mutable types, and that may change asynchronously after they are retrieved, are named get<PropertyName>. They take a pre-allocated object of the property type as their first argument, the contents of which shall be overwritten by the method. To facilitate method chaining, these methods also return a reference to this argument. This pattern forces the caller to make a copy, thereby avoiding unexpected changes to the property. An Entity’s status is an example of a property of this kind.

    (This pattern of passing a container to an object for that object to “fill in” has sometimes been referred to as a “bucket” pattern.)

    In cases where object-allocation performance is not a significant concern, the usability of this pattern can be improved with a trivial addition: allow the caller to pass in a null “bucket”, and require the implementation to allocate and return a new object with the appropriate contents.

    Proposed Resolution:

    Add a sentence to the bullet that indicates that a null argument is permitted.

    Proposed Revised Text:

    Replace the third bullet in section 7.1.5, “Method Signature Conventions” with the following:

    · Accessors for properties that are of mutable types, and that may change asynchronously after they are retrieved, are named get<PropertyName>. They take a pre-allocated object of the property type as their first argument, the contents of which shall be overwritten by the method. To facilitate method chaining, these methods also return a reference to this argument. The caller may alternatively pass a null argument into such accessor methods, in which case the implementation shall allocate a new object, set its contents appropriately, and return it. This pattern forces the caller to make a copy, thereby avoiding unexpected changes to the property. An Entity’s status is an example of a property of this kind.

  • Reported: DDS-Java 1.0b1 — Wed, 1 Jun 2011 04:00 GMT
  • Disposition: Resolved — DDS-Java 1.0b2
  • Disposition Summary:

    No Data Available

  • Updated: Fri, 6 Mar 2015 20:58 GMT