Can someone define what exactly 'POCO' means? I am encountering the term more and more often, and I'm wondering if it is only about plain classes or it means something more?
-
31It's also funny that "poco" is a Spanish word meaning "little, not much". So, it fits this context nicely! http://en.wiktionary.org/wiki/poco – EnocNRoll - AnandaGopal Pardue Apr 08 '10 at 14:30
-
8It means the exact same thing in italian too :) – BlackBear Jan 31 '12 at 18:40
-
3And in Portuguese means a error because it is spelled: "pouco". – Ismael Sep 27 '12 at 14:56
-
4In Polish "POCO" is question "Why use it" – titol Aug 20 '16 at 21:00
-
Just happens to fly by the POCO stuff. The official document now has the definition: [A POCO—or a plain old class/CLR object—is a .NET data structure that contains only public properties or fields.](https://learn.microsoft.com/en-us/dotnet/standard/glossary#poco) – victor6510 Jun 28 '22 at 05:07
11 Answers
"Plain Old C# Object"
Just a normal class, no attributes describing infrastructure concerns or other responsibilities that your domain objects shouldn't have.
EDIT - as other answers have stated, it is technically "Plain Old CLR Object" but I, like David Arno comments, prefer "Plain Old Class Object" to avoid ties to specific languages or technologies.
TO CLARIFY: In other words, they don’t derive from some special base class, nor do they return any special types for their properties.
See below for an example of each.
Example of a POCO:
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
}
Example of something that isn’t a POCO:
public class PersonComponent : System.ComponentModel.Component
{
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Name { get; set; }
public int Age { get; set; }
}
The example above both inherits from a special class to give it additional behavior as well as uses a custom attribute to change behavior… the same properties exist on both classes, but one is not just a plain old object anymore.

- 11,922
- 5
- 40
- 44
-
17I would view a POCO as a plain old class that doesn't try to be part of the trendy pattern set. However I like your answer too. – David Arno Oct 30 '08 at 12:40
-
1Agreed - not a fan of the C# name, but that was what I first heard when I was wondering about the question :) Class then fits POJO, POVBO POC#O, POC++O, PORO, etc. – David Mohundro Oct 30 '08 at 12:51
-
14This doesn't really give a good answer in my personal opinion as someone also curious. Ok, so no attributes describing infrastructure (what do you mean by attributes and infrastructure...a DB connection for example? what? example please). What responsibilities should your domain objects not have? So POCO is a domain object (BL object) basically? So really POCO is just another acronym for a Business Layer Object / Domain Object which all mean the same damn thing. POCO / Business Layer Object / Domain Object == same damn thing, just 3 different acronyms for the same concept right? – PositiveGuy Dec 21 '10 at 06:04
-
What really is needed here are references to some examples...some real world classes that are considered POCO. – PositiveGuy Dec 21 '10 at 06:07
-
5this reply tells me absolutely nothing about what it is in the real world...just a definition that anyone can look up on Wikipedia. How's about some example POCO classes?? and why they are POCO in context. – PositiveGuy Dec 23 '10 at 15:20
-
"Just a normal class, no attributes describing infrastructure concerns or other responsibilities that your domain objects shouldn't have." Define "normal class" and "no attributes describing infrastructure or other responsibilities". I have no idea what this means in specific context. – PositiveGuy Dec 23 '10 at 15:22
-
So is it safe to say: It's a class you created to do something. You didn't descend from something to inherit special functionality, and nobody's ever going to descend from it. It's just a plain old class that you wrote to do something. (?) – Ian Boyd Jul 02 '11 at 18:56
-
-
I have to agree with @CoffeeAddict; I came here not having heard this term before, and after reading this answer, I still don't know what it means. "no attributes describing infrastructure concerns or other responsibilities that your domain objects shouldn't have." -- what types of infrastructure concerns/responsibilities? Can you provide examples? – rory.ap Dec 17 '14 at 17:12
-
"they don’t derive from some special base class, nor do they return any special types for their properties." -- what constitutes a "special" base class? How would I know when I see one so that I can avoid deriving from it? Same with "special types". – rory.ap Dec 17 '14 at 17:12
-
2As an example, a class you wrote that only inherits from `System.Object` is a POCO. If it inherits from `ExternalFramework.OrmMapperBase` or something like that, it isn't a POCO anymore. – David Mohundro Dec 17 '14 at 17:19
-
AFAIK POCO objects have only member variables, manual and auto-implemented properties. They are mostly used for data transfer across layers like for data coming from Model towards application layer. Does an object qualify to be a POCO if I define additional methods in it as well? e.g. an `Employee` class has two properties named `FirstName` and `LastName` and I've defined a method as well in the class as `GetFullName`. – RBT Jul 19 '16 at 00:54
-
@RBT I'd personally say that yes, it still qualifies POCO, particularly if the methods don't modify any state. – David Mohundro Jul 19 '16 at 01:32
-
This answer is vague, raises even more questions so shouldn't be accepted or upviotd. – user3285954 Jul 20 '19 at 10:43
-
1I added an example of both a POCO and something that isn’t a POCO. Because there (arguably) isn’t consensus on if methods make something not a POCO or not, my examples don’t have them. Hopefully the examples are extreme enough to show something that is clearly a POCO and something that isn’t, though. – David Mohundro Jul 22 '19 at 21:10
-
@DavidMohundro I think your example is misleading because it lacks an explanation of why it isn't a _POCO_. We know that **a)** it derives from `Component` and **b)** it has a property decorated with `[DesignerSerializationVisibility]`. Is it because both **a)** AND **b)** are satisfied, or because either is satisfied? And if the latter, where do you draw the line of permitted attribute usage (or _"attributes describing infrastructure concerns"_)? Is `[DataMember]` a _POCO-breaker_ attribute? Or perhaps a XML specific attribute when you want to serialize it into JSON? – Grx70 Oct 28 '19 at 19:21
-
1Your description sounds more like a Data Transfer Object (DTO). See this comparison of [POCO vs DTO](https://stackoverflow.com/questions/725348/plain-old-clr-object-vs-data-transfer-object). – Jeppe Dec 28 '19 at 11:36
-
Most people have said it - Plain Old CLR Object (as opposed to the earlier POJO - Plain Old Java Object)
The POJO one came out of EJB, which required you to inherit from a specific parent class for things like value objects (what you get back from a query in an ORM or similar), so if you ever wanted to move from EJB (eg to Spring), you were stuffed.
POJO's are just classes which dont force inheritance or any attribute markup to make them "work" in whatever framework you are using.
POCO's are the same, except in .NET.
Generally it'll be used around ORM's - older (and some current ones) require you to inherit from a specific base class, which ties you to that product. Newer ones dont (nhibernate being the variant I know) - you just make a class, register it with the ORM, and you are off. Much easier.

- 8,061
- 2
- 31
- 30
-
4just for the sake of completeness, CLR stabds for Common Language Runtime - the .net virtual machine. – philant Oct 30 '08 at 14:05
-
4.Net 3.5 sp1 ORM example: the Entity framework requires that classes inherit from a certain framework class. LINQ to SQL does not have this requirement. Therefore LINQ to SQL works with POCOs and the Entity framework does not. – Lucas May 27 '09 at 16:05
I may be wrong about this.. but anyways, I think POCO is Plain Old Class CLR Object and it comes from POJO plain old Java Object. A POCO is a class that holds data and has no behaviours.
Here is an example written in C#:
class Fruit
{
public Fruit() { }
public Fruit(string name, double weight, int quantity)
{
Name = name;
Weight = weight;
Quantity = quantity;
}
public string Name { get; set; }
public double Weight { get; set; }
public int Quantity { get; set; }
public override string ToString()
{
return $"{Name.ToUpper()} ({Weight}oz): {Quantity}";
}
}

- 30
- 2
- 7

- 469
- 4
- 6
-
5This should be the accepted answer. It provides the actual explanation (It has no behaviors) and also has an example for better understanding what a POCO looks like. – Héctor Álvarez Apr 18 '18 at 14:33
-
1
-
3I would argue about a POCO not having behaviour. It is simply a class what doesn't depend on other framework/library than .Net. I.e. the File class is POCO, but DbContext is not because depends on Entity Framework. – user3285954 Jul 20 '19 at 10:49
-
1A POCO class can definitely has behavior (validation, calculation, transformation...) as long as the behavior doesn't depend on anything else than CLR basic types (string, int, bool...) and sibling POCO classes. – Patrick from NDepend team Mar 31 '21 at 10:31
In .NET a POCO is a 'Plain old CLR Object'. It is not a 'Plain old C# object'...

- 2,566
- 4
- 44
- 77
POCO stands for "Plain Old CLR Object".

- 106,424
- 25
- 145
- 137
-
26
-
29And as my high school electricity teacher would say, "...and oranges taste orangey" – Ian Boyd Jul 02 '11 at 18:52
-
9Right, but this post looks like more a comment, rather than an answer since it does not completely answer the question. – anar khalilov Dec 20 '13 at 15:19
-
To add the the other answers, the POxx terms all appear to stem from POTS (Plain old telephone services).
The POX, used to define simple (plain old) XML, rather than the complex multi-layered stuff associated with REST, SOAP etc, was a useful, and vaguely amusing, term. PO(insert language of choice)O terms have rather worn the joke thin.

- 42,717
- 16
- 86
- 131
In Java land typically "PO" means "plain old". The rest can be tricky, so I'm guessing that your example (in the context of Java) is "plain old class object".
some other examples
- POJO (plain old java object)
- POJI (plain old java interface)

- 730,956
- 141
- 904
- 1,278

- 29,624
- 9
- 57
- 79
Interesting. The only thing I knew that had to do with programming and had POCO in it is the POCO C++ framework.

- 10,406
- 6
- 33
- 48
In WPF MVVM terms, a POCO class is one that does not Fire PropertyChanged events

- 3,033
- 4
- 34
- 76
Whilst I'm sure POCO means Plain Old Class Object or Plain Old C Object to 99.9% of people here, POCO is also Animator Pro's (Autodesk) built in scripting language.

- 1,464
- 1
- 18
- 47
POCO is a plain old CLR object, which represent the state and behavior of the application in terms of its problem domain. it is a pure class, without inheritance, without any attributes. Example:
public class Customer
{
public int Id { get; set; }
public string Name { get; set; }
}

- 151
- 4