views:

24

answers:

1

I have seen these terms used interchangebly on the web for objects (.Net). Could someone explain the difference between them.

  • POCO
  • Entity
  • Model
  • Domain Object
  • Active Record

Are Entities and POCO the same/similar?

I normally think as Model objects as being part of the UI layer of an N-Tier architecture, is this correct?

Are there any other "names" for such objects?

These are very broad questions I understand but I am aware is a broad subject!

A: 

Here's my take:

  1. POCO - Plain Old C# Object, follows after Martin Fowler's POJO for Plain Old Java Object. It was a reaction against EJB 2.0, which required two interfaces and extending a class just to express an entity EJB. The idea of POJO/POCO emphasizes creating domain objects as instances of classes, not requiring heavy framework machinery.
  2. Entity - This is a synonym for a persistent object to me. The Java Enterprise Java Bean spec divides the world into entity, stateless session, stateful session, and message driven beans. Session beans are like services - functional objects that implement useful business logic. Message driven beans are associated with queues and perform asynchronous logic.
  3. Model - Union of all your domain objects; may or may not be POCOs/POJOs.
  4. Domain Object - This is an abstract idea for an object that describes the business problem you're trying to solve. See Eric Evans' "Domain Driven Design".
  5. Active Record - Another Martin Fowler term from PEAA; it's a wrapper for a database row that adds logic.
duffymo