Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>A POCO follows the rules of OOP. It should (but doesn't have to) have state <em>and</em> behavior. POCO comes from POJO, coined by Martin Fowler [<a href="http://www.martinfowler.com/bliki/POJO.html" rel="noreferrer">anecdote here</a>]. He used the term POJO as a way to make it more sexy to reject the framework heavy EJB implementations. POCO should be used in the same context in .Net. Don't let frameworks dictate your object's design.</p> <p>A DTO's only purpose is to transfer state, and should have no behavior. See Martin Fowler's <a href="http://martinfowler.com/eaaCatalog/dataTransferObject.html" rel="noreferrer">explanation of a DTO</a> for an example of the use of this pattern.</p> <p>Here's the difference: <strong>POCO describes an approach to programming</strong> (good old fashioned object oriented programming), where <strong>DTO is a pattern</strong> that is used to "transfer data" using objects.</p> <p>While you can treat POCOs like DTOs, you run the risk of creating an <a href="http://www.martinfowler.com/bliki/AnemicDomainModel.html" rel="noreferrer">anemic domain model</a> if you do so. Additionally, there's a mismatch in structure, since DTOs should be designed to transfer data, not to represent the true structure of the business domain. The result of this is that DTOs tend to be more flat than your actual domain.</p> <p>In a domain of any reasonable complexity, you're almost always better off creating separate domain POCOs and translating them to DTOs. DDD (domain driven design) defines the <a href="http://books.google.com/books?id=7dlaMs0SECsC&amp;lpg=PA366&amp;ots=ulHUZZRdr2&amp;dq=anti%20corruption%20layer&amp;pg=PA364#v=onepage&amp;q&amp;f=false" rel="noreferrer">anti-corruption layer</a> (another link <a href="http://moffdub.wordpress.com/2008/09/21/anatomy-of-an-anti-corruption-layer-part-1/" rel="noreferrer">here</a>, but best thing to do is <a href="http://rads.stackoverflow.com/amzn/click/0321125215" rel="noreferrer">buy the book</a>), which is a good structure that makes the segregation clear.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload