Plain Old CLR Object
Plain Old CLR Object or POCO is a play on the term POJO, from the Java EE programming world (which was coined by Martin Fowler in 2000 [1]), and POTS Plain old telephone service, from the analog telephone world, and is used by developers targeting the Common Language Runtime of the .NET Framework. Simply put, a POCO does not have any dependency on an external framework.
Similar to the Java context, the term is used to identify an object as a simple object, as opposed to the complicated, specialized objects that frameworks like ORM systems usually generate. Another way to put it is that POCOs are objects unencumbered with inheritance or attributes needed for specific frameworks [2] and are persistence ignorant objects. In .NET terms, the word is most often used in the programmatic sense, to differentiate a non-serviced component (see MTS) from a "standard object". It can also be used in a tongue-in-cheek manner, referencing the perceived complexity and invasiveness of Java-based programming frameworks such as the legacy EJB2.
POCO is often incorrectly expanded to Plain Old C# Object, but POCOs can be created with any language targeting the CLR. An alternative acronym sometimes used is PONO,[3] for Plain Old .NET Object.
Some benefits of POCO objects are:
- Allows a simple storage mechanism for data, and simplifies serialization/passing data through layers.
- Goes hand-in-hand with dependency injection, and the repository pattern.
- Minimized complexity and dependencies on other layers (higher layers only care about the POCOs, POCOs don't care about anything) which facilitates loose coupling.
- Increases testability through simplification.
See also
- Plain old data structure
- Plain Old Java Object
- Data Transfer Object
- POTS for Plain old telephone service
References
- ↑ See anecdote here: http://www.martinfowler.com/bliki/POJO.html
- ↑ See, for example, this MSDN article: Data Contracts - POCO Support
- ↑ See, for example, a reference to PONO in this whitepaper: Spring.net Reference Documentation