2

I've seen the question, "what does POCO mean?" asked all over the net, and seen plenty of explanations, but it's still not clear to me. I know it stands for "Plain Old CLR Object", but this isn't really helping me to understand.

Can someone please give me a few examples of something that is NOT a POCO and explain why it is NOT a POCO?

Thanks.

edit: I'm beginning to come to the conclusion that a POCO object is any object that can be easily converted to an identical object in any other CLR-supported language because it does not rely on any platform-specific or language specific library that is not universally available.

cwm9
  • 763
  • 5
  • 15

2 Answers2

2

POCO just means: nothing but a pure class. No inheritance from any base class (other than eventually your own), no decoration with any attributes, no interface implementation of any kind (other than eventually your own), nothing else that would tie the code in any way to a certain technology.

Thomas Weller
  • 11,631
  • 3
  • 26
  • 34
1

Mostly the term is used in situations where a framework provides you with some services (like persistence in case of an ORM) wihout you having to change anything on your business objects. Other frameworks might demand from you that your objects be derived from some base class, or implement some interface. In case of a POCO, it just your plain object, no changes needed.

Richard
  • 627
  • 7
  • 14
  • Are you saying that what makes an object POCO is that it relies on nothing external to the object istself? Is an object based on the STL not a POCO object because it is makes use of STL? – cwm9 Dec 04 '13 at 22:11
  • @cwm9 I'm saying that your object relies on only the constructs of your own choosing (such as an STL), not constructs from external libraries that you might want to swap out next week for some other library. The answer stefan2410 refers to is really good. – Richard Dec 07 '13 at 11:56