Plain Old Java Object

POJO is an acronym for Plain Old Java Object, so a " normal " object in the Java programming language.

Motivation

The term was coined in September 2000 by Martin Fowler, Rebecca Parsons and Josh MacKenzie with the intention to distinguish simple Java objects objects with a variety of external dependencies. Such external dependencies can be, for example, mandatory -to-implement interfaces, compulsory naming conventions or necessary annotations. The basic idea is: " the simpler, the better" and is also known as the KISS principle.

"We [M. Fowler, R. Parsons, J. MacKenzie ] Wondered why people were so against using regular objects in Their systems and Concluded did it Because what simple objects Lacked a fancy name. So we gave them one, and it's caught on very nicely. "

"We [M. Fowler, R. Parsons, J. MacKenzie ] wondered why people were so against it to use in their systems, regular objects and came to the conclusion that an original name for simple objects missing. So we gave them one, and he was very well received. "

Use

The term is used primarily in connection with object-relational mapping concepts and tools such as Hibernate or JDO in which the domain model can be constructed from POJOs, while in contrast, extensive conventions are followed for Entity Beans.

Freed from conventions is a POJO understood as an object in the real sense of object orientation, that is a unit consisting of data and behavior, to which the well-known principles of low coupling and strong encapsulation are applied. A POJO is thus usually more than just a collection of getters and setters.

Another domain in which the term POJO is used, the world of Inversion of Control container like Spring or PicoContainer is. Here "simple" Java objects are to be used, while external dependencies outside this be resolved by the container.

Variations

Since November 2005, the term " POJO " is mainly used to describe an object that does not correspond to the large Java object models, conventions, or frameworks such as EJB.

A POJO is a Java object that has no limitations except those of the Java Language Specification. That is, a POJO should not:

Public class Foo extends { javax.servlet.http.HttpServlet ... prespecified implement interface, such as here: public class Bar implements javax.ejb.EntityBean { ... contain pre-specified annotation, such as here:        @ javax.ejb.Entity        public class House { ... References

  • Java ( programming language)
652551
de