Proto Value

ProtoValue is the shorthand for a prototype ValueObject in gestation. It is an implementation concept from the JavaValue ValueObjectFramework.

Whenever you implement a ValueObjectFramework where you want to share the value objects (for reasons of performance and saving memory), your value management scheme needs to check whether the value object requested by a client already exists. To do this, it has to calculate something like a hash code from the value objects fields. To do this, it typically needs a value object, because that's where the hash code calculation method is implemented.

Now, if we create a new value object for each client request and throw it away later, when we figure out that the value object being requested already exists, we are pretty wasteful. In particular, performance and the garbage collector will hurt you.

So, the JavaValue framework maintains a hidden value object, the ProtoValue, that is reused from client request to client request to calculate the hash code.

Voila, one way how a ValueObjectFramework can provide you with reusable code that you don't have to write yourself.

--DirkRiehle

EditText of this page (last edited February 3, 2000) or FindPage with title or text search