US Patent 6,438,560: Reuse of immutable objects during object creation (IBM Corporation)
Thursday, April 24, 2008 at 3:00AM
Steve Holcombe

Title: Reuse of immutable objects during object creation
Patent Number: US Patent 6,438,560
Issued: August 20, 2002
Filed: September 16, 1999
Parent case:
Inventor(s): Loen, Larry Wayne
Assignee: IBM Corporation
Referenced at issuance: US Patent 5,724,588 (Microsoft Corporation)Φ
Distinguished after issuance from: US Patent 6,671,696 (Pardalis Inc.) and US Patent 7,136,869 (Pardalis Inc.)
Blogger comment(s): 

There were 6 prior US patents referenced at issuance, including US Patent 5,724,588, of which the remaining 5 are unremarkable for the scope and purposes of this blog. There were also 2 foreign patent documents referenced at issuance; however, until such time as I have time to review them, no comment is made.

An advanced search at USPTO online on May 9, 2008 for references to this patent using ref/6438560 reveals 10 references. A more refined search reveals US Patent 7,136,869 and US Patent 6,671,696, referenced above.

Abstract:

An apparatus, program product, and method of processing a request to create an immutable object reuse of an existing immutable object in appropriate circumstances to represent redundant data without the necessity for creating an additional immutable object.

Independent claims (as numbered):

1. A method of processing a request to create an immutable object, the method comprising: (a) determining whether a matching immutable object exists having redundant content with respect to the requested immutable object; (b) if a matching immutable object exists, returning a reference to the matching immutable object as a response to the request; and (c) if no matching immutable object exists, creating a new object and returning a reference to the new object as the response to the request;

wherein determining whether a matching immutable object exists includes accessing an immutable object data structure that identifies at least one existing immutable object, and wherein creating the new object further includes storing an identifier for the new object in the immutable object data structure.

8. A method of accessing data from a database, the method comprising: (a) generating a result set in response to a database query; (b) retrieving data from the result set, including: (i) generating a request for an immutable object in the result set; (ii) determining whether a matching immutable object exists having redundant content with respect to the requested immutable object; (iii) if a matching immutable object exists, returning a reference to the matching immutable object as a response to the request; and (iv) if no matching immutable object exists, creating a new object and returning a reference to the new object as the response to the request;

wherein retrieving data from the result set further includes generating a get string request to retrieve a field from a database record in the result set to retrieve a reference to an immutable string object and retrieving the contents of the requested field.

10. A method of accessing data from a database, the method comprising: (a) generating a result set in response to a database query; (b) retrieving data from the result set, including: (i) generating a request for an immutable object in the result set; (ii) determining whether a matching immutable object exists having redundant content with respect to the requested immutable object; (iii) if a matching immutable object exists, returning a reference to the matching immutable object as a response to the request; and (iv) if no matching immutable object exists, creating a new object and returning a reference to the new object as the response to the request; (c) tracking a performance characteristic associated with successfully locating matching immutable objects over a plurality of iterations of creating immutable objects; and (d) inhibiting determining whether a matching immutable object exists in response to the performance characteristic matching a predetermined state.

11. An apparatus, comprising: (a) a memory; and (b) a program, resident in the memory, the program configured to determine, in response to a request to create an immutable object, whether a matching immutable object exists having redundant content with respect to the requested immutable object, and if so, to return a reference to the matching immutable object as a response to the request, wherein the program is further configured to create a new object and return a reference to the new object as the response to the request if no matching immutable object exists, and wherein the program is further configured to determine whether a matching immutable object exists by accessing an immutable object data structure that identifies at least one existing immutable object, and, during creation of a new object, to store an identifier for the new object in the immutable object data structure.

13. An apparatus, comprising: (a) a memory; and (b) a program, resident in the memory, the program configured to determine, in response to a request to create an immutable object, whether a matching immutable object exists having redundant content with respect to the requested immutable object, and if so, to return a reference to the matching immutable object as a response to the request, wherein the program is further configured to track a performance characteristic associated with successfully locating matching immutable objects over a plurality of iterations of creating immutable objects, and to inhibit determination of whether a matching immutable object exists in response to the performance characteristic matching a predetermined state.

15. An apparatus, comprising: (a) a memory; and (b) a program, resident in the memory, the program configured to determine, in response to a request to create an immutable object, whether a matching immutable object exists having redundant content with respect to the requested immutable object, and if so, to return a reference to the matching immutable object as a response to the request, wherein the request to create an immutable object is generated in response to an attempt to access data from a result set generated in response to a database query, and wherein the requested immutable object is a string object representing a field from a database record in the result set.

16. A program product, comprising: (a) a program configured to determine, in response to a request to create an immutable object, whether a matching immutable object exists having redundant content with respect to the requested immutable object, and if so, to return a reference to the matching immutable object as a response to the request, wherein the program is further configured to create a new object and return a reference to the new object as the response to the request if no matching immutable object exists, and wherein the program is further configured to determine whether a matching immutable object exists by accessing an immutable object data structure that identifies at least one existing immutable object, and, during creation of a new object, to store an identifier for the new object in the immutable object data structure; and (b) a signal bearing media bearing the program.

Key Drawing(s):

2093760-1685554-thumbnail.jpg
[Original image modified for size and/or readability]
"Immutable object reuse may be implemented in a number of programming applications. For example, as shown in FIG. 3, one representative generic create object routine, called in response to a request to create a new object, is illustrated at 50. Such a request may be an explicit request by a specific program instruction in a computer program. In the alternative, however, such a request may be an inherent component of a particular request, e.g., a request to retrive a field from a record in a result set from a database."

"Routine 50 begins in block 52 by determining first whether the object is immutable. Such a determination may be based upon a particular field or flag defined for the object, or by analyzing the context in which an object is created. In other instances, however, an object of a particular class type may be inherently immutable, with the create object routine utilized to create such an object being specific to that particular class type. As such, in some implementations block 52 may be omitted, it being understood that the object requested to be created must be previously known to be of an immutable type."
"If the object is not mutable, a conventional object creation operation is performed by passing control to a construct new object lock 54. Construction of a new object includes both allocating storage for the object and initializing the object with the requested information. Once the new object is being constructed, control passes to block 56 to return a reference to the new object as the result of routine 50."

"Returning to block 52, if the object is determined to be immutable, control passes to block 58 to search for an existing immutable object having redundant content with respect to the requested object, typically by determining if the respective contents of an existing and requested object are the same. It will be appreciated that performing such a search will vary depending upon the particular storage data structure in which immutable objects are stored. Furthermore, the comparison of contents may vary depending upon the particular data type representing the contents of an object."

"Typically, all of the contents must match between an existing object and an object to be created before a successful (found) result is returned. However, in some instances it may be possible for only a particular data field within a more complex immutable object to be reused, without necessarily reusing the entire object. "

"Control next passes to block 60 to determine whether the search for an existing immutable object with the same content was successful. If not, control passes to block 54 to construct a new object and return a reference to the new object, representing the conventional creation of an object."

"However, if a matching immutable object has been found, block 60 passes control to block 62 to simply return a reference to the existing object that was found in response to the search. As a result, the calling object or routine will receive a reference to the existing object that can be utilized in essentially the same manner as a newly constructed object would be utilized were a new object created."

"In addition, as represented at block 64, in some implementations it may also be desirable to selectively enable or disable the immutable object reuse function to optimize the performance of routine 50 based upon the perceived redundancy of data accessed by the routine. In such instances, rather than passing control from block 52 to block 58 upon determining that an object to be created is immutable, control instead would pass first to block 64, which, based upon whether the reuse function was enabled, would pass control either to block 58 or block 54."

"As one example of a situation where selective enablement would be desirable, consider that in any database, some information is usually more redundant than other information. In a database of customer records containing fields with state, city, street, last name, first name, etc., for example, the state information would likely be highly redundant, while other information, e.g., the first name information, would likely be less redundant. In the latter instance, the overhead associated with searching for existing immutable objects might in actuality decrease performance due to a relatively low rate of success in attempting to locate matching immutable objects. As such, it may be desirable in some implementations to track the performance of the immutable object reuse function and selectively enable or disable the function based upon the tracked results."

Article originally appeared on The @WholeChainCom Blog (http://www.pardalis.com/).
See website for complete article licensing information.