EJB design: Java Vaue Type V/s Value Object pattern
Can anybody please explain me the differences between Java Value Type and Value Object pattern
- Posted by: Monami Sharma
- Posted on: June 09 2004 23:35 EDT
- Java Vaue Type V/s Value Object pattern by YOYO XXX on June 10 2004 09:02 EDT
- Java Vaue Type V/s Value Object pattern by Leon Pu on June 10 2004 21:50 EDT
- Java Vaue Type V/s Value Object pattern by Rahul Garg on June 11 2004 17:08 EDT
- Java Value Type V/s Value Object pattern by Monami Sharma on June 14 2004 00:49 EDT
Can anybody please explain me the differences between Java Value Type and Value Object patternIt should be the same thing with different names.
Excuse me, I just know there are Transfer Object and Value Object.
What is Value Type?
In my mind, a value type is:
In Java a = b makes a copy of b and puts it in a when a is a primitive e.g. int, long, float or double. This means that a is really value type. So java uses value type for primitives.
Typically objects (a) in java are a reference value and receive a pointer (reference) to the same object that b points to.
If the objects are created by value, they are value objects. eg. a primitive int object would be replaced by an Integer object instance declared to be a Value object.
Some thoughts on using value objects are:
There is no polymorphic behavior with value objects (static method resolution). Arrays of value objects occupy a single contiguous block of memory. Member variables that are value objects occupy the same memory block as the parent object. Value objects instantiated in a statement block (like a method), are stack allocated. Value objects returned from methods are allocated on the stack... All of these optimizations would lead to lower memory usage, faster code, and reduced burden on the gc.
Friends if you all can plese type Java Value Type in google and analyse the search results may be that can remove your doubts like same with diff name or never heard of thing.Becoz i am not able to grasp exactly what it is .I can give you the hints like JVT is related with managing managed entity beans or something like that .