Mutable Data Structure is something which gives you a provision to add edit data in it. so the opposite of data structure is an Object.
Object doesn’t gives you a provision to edit its state (only in extreme conditions you do that, when no options left). Object gives behavior.
Frameworks like JEE frameworks, spring, Hibernate and others gives a false definition of POJO (mixing it with JavaBeans). i.e. a class having private fields and getter setter methods. Basically these are Data structures and not Objects.
shital sonavane wrote:Here is the source for my quotes.. http://novice2wise.blogspot.in/2016/07/understanding-pojo.html
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
shital sonavane wrote:Here is the source for my quotes.. http://novice2wise.blogspot.in/2016/07/understanding-pojo.html
“...or required.” ?? What does that mean? It means it only has to change when it has to change. That is a grammatical tautology, which I think vitiates part of that article, with or without the other errors.But when we say it's an object, it gives behavior, it doesn't allows to modify the state unless and until its an extreme condition or required.
M Khalid wrote:Alan Kay contributed in Smalltalk
Smalltalk is a "pure" object-oriented programming language, meaning that, unlike Java and C++, there is no difference between values which are objects and values which are primitive
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
shital sonavane wrote:Agree with Winston. We are here to discuss what is POJO? And is it good practice to add getters and setters in POJO.
shital sonavane wrote:Agree with Winston. We are here to discuss what is POJO? And is it good practice to add getters and setters in POJO.
Stephan van Hulst wrote:I don't agree. It's good practice to make your data private. You add getters and setters only when necessary.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Stephan van Hulst wrote:By definition of the term POJO, there are no special restrictions on such an object, including whether or not to use setters or getters.
SCJP
Visit my download page
Good grief! Where did you read that? It sounds just as wrong as the things in the blog mentioned earlier.Randall Twede wrote:. . . POJO . . . doesn't inherit from any class or interface.
Campbell Ritchie wrote:Where did you read that?
Wikipedia wrote:Ideally speaking, a POJO is a Java object not bound by any restriction other than those forced by the Java Language Specification; i.e. a POJO should not have to:
Extend prespecified classes, as in
public class Foo extends javax.servlet.http.HttpServlet { ...Implement prespecified interfaces, as in
public class Bar implements javax.ejb.EntityBean { ...Contain prespecified annotations, as in
@javax.persistence.Entity public class Baz { ...
Wikipedia wrote:Spring was an early implementation of this idea and one of the driving forces behind popularizing this model.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Spoor wrote:It doesn't say they can't.
Beginning POJOs From Novice to Professional (2006) – Page 111 wrote:Hibernate does not force you to implement any special interfaces or extend any particular class; you can work with clean and simple POJOs.
Daniel Cox wrote:
Rob Spoor wrote:It doesn't say they can't.
I think it does.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Rob Spoor wrote:That articles says that POJO's don't have to extend a class or implement an interface. It doesn't say they can't.
Daniel Cox wrote:I see your point. A POJO is not bound by any special restriction to extend a class or implement an interface; however, this does not mean that it cannot extend a class or implement an interface.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:In fact, if it can't, I'd say that it isn't a Java object.
Winston Gutkowski wrote:I'm not exactly sure where I'd put Hibernate objects in that definition - probably somewhere in between: They can be used like POJOs, but their structure is often dictated by the table(s) that populate them.
Daniel Cox wrote:What makes them POJOs is that they are not aware of the technology that is used to persist them.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |