DTORP
Data Transfer Objects,
with their Properties,
should contain other DTOs
along with their Properties
DTORP Abstract:
A Data Transfer Object, a DTO, or sometimes referred to as an Abstract Data Type, a ADT, is a C# Plain Old CLR Object referred to as a POCO.
A DTO is a Class that Encapsulates
State Property Objects
The DTO is a serializable object that is used to transfer data across multiple layers of an n-Tier Enterprise Architecture.
DTOs can be an Aggregate DTO or a Composite DTO
-
An Aggregate DTO holds Primitive types and other Aggregate DTOs as DTO member types.
-
An Aggregate DTO has no real Domain Object value unto itself
-
An Aggregate has Domain value only when a member of a Composite
-
-
A Composite DTO is a Domain Entity that contains all the property members required to server a Business Object function.
-
A Composite DTO has Domain Value as a State Object
-
A Composite DTO can contain member types that are Primitive Properties and Aggregate DTOs
-
A Composite DTO can be a Member of a Higher Level Composite
… DTOs Manage Data State of Data in Assemblies
Description:
Data Transfer Objects are used to Manage State.
There are two primary types of DTO State Objects:
-
Aggregate DTO – Encapsulates the lowest level State Property objects such as Primitive Types and other Aggregate DTO that holds related State objects.
This object has no Global Domain Entity value without being a member of a higher level Composite DTO.
An Aggregate DTO has no identity on its own.It is a Domain Value Object but not a Domain Entity Object.
Aggregates can generally be destroyed and recreated without any effect to the current state of an application.
They are not session-centric and are generally not mutable. -
Composite DTO – Encapsulates Aggregates DTO Members as Value objects and higher level Primitive Types for Composite-centric properties.
A Composite DTO can be a functional Domain Entity or a member Aggregate of a higher level Composite DTO Domain Entity.
This DTO type generally has an identity and can function as a Domain Aggregate Root.
An Example of the DTORP Principle:
- The ENGINE DTO
- The BODY DTO
- The CHASSIS DTO
- The INTERIOR DTO
- The TIRES DTO
A TIRE is an Aggregate Value Object. It holds all the attributes as Properties about the Single Tire object. The TIRES Entity Object DTO holds all the attributes for the collection of all TIRE Value Objects and the Collection of four TIRE Aggregate Value Objects as a List property. The TIRE aggregate has no value unto itself. It only has value when it is a member of a List Property in the TIRES Composite object. It tells the Entity Composite CAR everything about the single TIRE Value Object.
The list of tires only has value when it is part of the TIRES Composite.
The TIRES Composite Is an Entity for the Tire Value Object. It has an Identity as a collection of TIRE but has no Domain Identity as its true Domain value only exists as an Aggregate Composite in the CAR Entity Composite.
Each TIRE can be destroyed and recreated without any effect to the CAR Composite … That is the Litmus Test for a Value Object …… Will its Destruction and Recreation Adversely effect on the Highest Level Entity
Likewise the TIRES Composite can be destroyed and recreated as well without any effect on the ability for the CAR Entity Composite to perform but the CAR Composite cannot perform without the TIRES Entity Composite of the TIRE Value Objects. The TIRES Composite DTO is a Value Object for the Domain and an Entity Object Container for the Tire Value Object collection.
CAR is the Identity Entity Business Object: VEHICLE
A Domain Entity is an Object Representation of a Business Requirement that has been Defined in a User Story
Latest posts by Brad Huett (see all)
- DevOps: A Bridge to Your DevOps Culture - March 25, 2016
- Embracing Test Driven Development (TDD) - March 25, 2016
- DevOps: Delivering Agile Projects - March 25, 2016