• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Difference between Value Object, Java Bean & POJO

 
Ranch Hand
Posts: 45
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anybody tel me the difference between the mostly frequently used words

Value Object, Java bean and POJO ?

Thanks.

Regards
Senthil Kumar Sekar
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Read these - Ranch old thread 1
Ranch old thread 2

and from other forum
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A Java Bean is a Java class that has getters and setters in order to conform to Java-bean standards.
Essentially you declare properties private and use getters and setters to read or modify the data.
The standardization was introduced to enable automatic access to properties via Java reflection to automate some activity performed e.g. by application servers.

A POJO is a “plain old java object” hence and instance of a simple java class: the term is used to contrast to the EJB (Enterprise Java Beans).
Enterprise beans are the Java beans used in JEE applications that are Java Beans that live in an application server that enables inter process communication and remote communication, dealing also with transactions and security.

The term was used to mean "go back to simple objects" and stop using Java EE.

The term “Value Objects” is used with different meanings.
Some call a value-object a DTO: which usually is aq class with no logic use only to pack information in a single item like a C Struct.

But the most wide-spread interpretation is a type of object that does not exist (yet) in Java.

The difference is determined by the behaviour of the assignment of such an object to another one.

In java a Struct or a Class are the same and any instance derived from a Class/Struct is an object used with the “reference logic”.
Hence when you do an assignment of an object you copy a reference to a memory address that holds the data associated with object.

In C# instead a Struct is a Value Object and is different from a Class.
In this case if you assign an object implementing a struct the value is copied and not a reference to the object.

The memory management is also different since the data of a Struct in C# is kept in the stack while for the classes the data is stored in the heap and the reference in the stack.
This helps in performance.
 
reply
    Bookmark Topic Watch Topic
  • New Topic