4
What’s the difference between DTO, POCO, MODEL? Because I am developing a layered application, DAL, BLL and UI.
4
What’s the difference between DTO, POCO, MODEL? Because I am developing a layered application, DAL, BLL and UI.
7
POCO is derived from POJO. The term was coined by Martin Fowler. POCO (usually) follows the classical precepts of object-oriented programming such as state and behavior. For example:
classe Porta
{
// Estado
booleano Aberta;
// Comportamentos
metodo Fechar()
{
Aberta = falso;
}
metodo Abrir()
{
Aberta = verdadeiro;
}
}
DTO would be a data subject to data transfer, in Portuguese. Ele seria mais a representação de um modelo de dados, portanto, contendo apenas "estados", sem comportamentos.
classe Porta
{
// Estado
booleano Aberta;
}
// Não existe aqui "Abrir" ou "Fechar": aqui se manipula diretamente os valores.
minhaPorta = nova Porta();
minhaPorta.Aberta = falso;
minhaPorta.Aberta = verdadeiro;
A Model, or model, is already somewhat self-explanatory: it represents a data model of some entity about which one wishes to describe, but not only this: it also describes the relations between other entities. The more increased the Model in the matter of his technological description, the closer he gets to a DTO than of a POCO.
The frameworks usually diverge on what a Model approaches. In some cases, such as Django and Ruby on Rails, the Model approaches a POCO. In others, such as ASP.NET MVC and Hibernate, it approaches a DTO.
In any case, the Model is what least serves for a three-tier architecture (as proposed in the question) precisely because it is a design standard aimed at the operation of a framework MVC, where objects and the relationships between them have a much more technological footprint than in purely object-oriented architecture. Interestingly, 3-layered architecture comes closer to the purely object-oriented approach than MVC.
Browser other questions tagged pattern-design poco
You are not signed in. Login or sign up in order to post.