Plain Old Java Object

Plain Old Java Object

POJO ist eine Abkürzung für Plain Old Java Object, also ein „ganz normales“ Objekt in der Programmiersprache Java.

Inhaltsverzeichnis

Motivation

Der Ausdruck wurde im September 2000 von Martin Fowler, Rebecca Parsons und Josh MacKenzie mit der Absicht geprägt,[1] einfache Java-Objekte von Objekten mit vielfältigen externen Abhängigkeiten unterscheiden zu können. Solche externen Abhängigkeiten können beispielsweise zwingend zu implementierende Schnittstellen, einzuhaltende Namenskonventionen oder notwendige Annotationen sein. Die grundlegende Idee lautet dabei „je einfacher, desto besser“, auch als KISS-Prinzip bekannt.

“We[M. Fowler, R. Parsons, J. MacKenzie] wondered why people were so against using regular objects in their systems and concluded that it was because simple objects lacked a fancy name. So we gave them one, and it's caught on very nicely.”

„Wir[M. Fowler, R. Parsons, J. MacKenzie] fragten uns, warum die Leute so dagegen waren, in ihren Systemen reguläre Objekte zu nutzen und kamen zu dem Schluss, dass einfach ein origineller Name für einfache Objekte fehlte. Also gaben wir ihnen einen, und er wurde sehr gut angenommen.“

Martin Fowler

Verwendung

Der Begriff wird vor allem im Zusammenhang mit Object-Relational-Mapping-Konzepten und -Tools wie Hibernate oder JDO verwendet, bei denen das Domain Model aus POJOs aufgebaut werden kann, während im Gegensatz dazu bei Entity Beans umfangreiche Konventionen einzuhalten sind.

Befreit von Konventionen wird ein POJO als ein Objekt im eigentlichen Sinne der Objektorientierung verstanden, d. h. eine Einheit bestehend aus Daten und Verhalten, auf die die bekannten Grundsätze niedrige Kopplung und starke Kapselung angewendet werden. Ein POJO ist somit im Regelfall mehr als nur eine Ansammlung von Gettern und Settern.

Eine weitere Domäne, in der der Begriff POJO eingesetzt wird, ist die Welt der Inversion-of-Control-Container wie Spring oder PicoContainer. Auch hier sollen „einfache“ Java-Objekte zum Einsatz kommen, während externe Abhängigkeiten außerhalb dieser vom Container aufgelöst werden.

Variationen

Seit November 2005 wird der Begriff „POJO“ hauptsächlich verwendet, um ein Objekt zu beschreiben, das nicht den großen Java-Objekt-Modellen, Konventionen, oder Frameworks wie EJB entspricht.

Ein POJO ist ein Java-Objekt, das keinerlei Einschränkungen bis auf die der Java Language Specification hat. Das heißt, ein POJO sollte keine:

  1. vorspezifizierte Klasse erweitern, wie z. B. hier:
    public class Foo extends javax.servlet.http.HttpServlet {
  2. vorspezifiziertes Interface implementieren, wie z. B. hier:
    public class Bar implements javax.ejb.EntityBean {
  3. vorspezifizierte Annotation enthalten, wie z. B. hier:
      @javax.ejb.Entity
      public class Haus {

Einzelnachweise

  1. Martin Fowler: MF Bliki: POJO. Abgerufen am 7. Februar 2008.

Wikimedia Foundation.

Игры ⚽ Нужно сделать НИР?

Schlagen Sie auch in anderen Wörterbüchern nach:

  • Plain Old Java Object — Es el acrónimo de Plain Old Java Objetct. Un POJO es una clase java normal. Este nombre se les da a las clases que no son de algún tipo especial (EJBs, Java Beans, etc) y no cumplen ningun otro rol ni implementan alguna interfaz especial …   Enciclopedia Universal

  • Plain Old Java Object — POJO is an acronym for Plain Old Java Object, and is favoured by advocates of the idea that the simpler the design, the better.The name is used to emphasize that the object in question is an ordinary Java Object, not a special object, and in… …   Wikipedia

  • Plain Old Java Object — POJO est un acronyme qui signifie Plain Old Java Object que l on peut traduire en français par bon vieil objet Java. Cet acronyme est principalement utilisé pour faire référence à la simplicité d utilisation d un Objet Java en comparaison avec la …   Wikipédia en Français

  • Plain Old Java Object — Un POJO (acrónimo de Plain Old Java Object) es una sigla creada por Martin Fowler, Rebecca Parsons y Josh MacKenzie en septiembre de 2000 y utilizada por programadores Java para enfatizar el uso de clases simples y que no dependen de un framework …   Wikipedia Español

  • Plain Old CLR Object — POCO es un acrónimo de Plain Old CLR Object. Es un juego de palabras del POJO de la plataforma Java, y es utilizado por los desarrolladores de la plataforma .NET Framework. Un POJO (Plain Old Java Object) es una sigla creada por Martin Fowler,… …   Wikipedia Español

  • Plain Old C++ Object — Like the term plain old Java object (POJO) in the Java world, the term Plain Old C/C++ object or its acronym POCO means a C/C++ artifact that is neither defined by nor coupled to the underlying C/C++ component framework that manipulates it.… …   Wikipedia

  • Plain Old CLR Object — POCO is an acronym for Plain Old CLR Object. It is a play on the term POJO, from the Java programming world, and is used by developers targeting the Common Language Runtime of the .NET Framework. Similar to the Java context, the term is used to… …   Wikipedia

  • Plain Old Java Object — …   Википедия

  • Plain Old Data Structures — (PODS) are data structures that are represented only as passive collections of field values, without using encapsulation or other object oriented features.Plain Old Data Structures are appropriate when there is a part of a system where it should… …   Wikipedia

  • Plain Old XML — POX redirects here. For other uses, see Pox. Plain Old XML (POX) is a term used to describe basic XML, sometimes mixed in with other, blendable specifications like XML Namespaces, Dublin Core, XInclude and XLink. People typically use the term as… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”