Using presentation model components and entities in ntier architecture
When designing applications that will run in the n-tier environment there are some additional factors to be considered. First of all it is very likely that your business entities will be located on separate machine. In this scenario there is a need to create objects in your UI layer that will have functionality of the business objects sitting on separate tier. Those objects should also include businesses validation logic and be able to easily apply bindings to UI components.
When transferring business entity data between the tiers, there is a need to create “data transformation objects” that transport object information across the network (if not invoked directly). DTOs also allow to separate layers and expose only those data that we will use (encapsulation). It is especially useful when using restful services.
Diagram below shows the typical n-tier architecture using presentation components and entities.
Diagram 1. Presentation model components and entities in multi tier application (please refer to “Microsoft Application Architecture Guide, 2nd Edition” book for more details).
Please note that using DTOs may incur some performance lost as the objects need to be mapped and transformed between the layes/tiers. Solution for that could be executing batch commands at once sending final results as combined object to avoid round trips within the network.
If your tiers are located within your local network it is advisable to use TCP protocol(more efficient) otherwise use HTTP/HTTPS when transferring data across the public network.