You get a bonus - 1 coin for daily activity. Now you have 1 coin

Patterns of data distribution Remote Facade, Data Transfer Object

Lecture



  • Remote Facade (Front Entrance)
  • Data Transfer Object

Remote Facade (Front Entrance)

Patterns of data distribution Remote Facade, Data Transfer Object

Remote Facade Design Pattern

Remote Facade Description

Provides a common unifying interface for a set of object methods to improve the efficiency of network interaction.

The Remote Facade pattern in an object-oriented model improves work with small objects that have small methods. Small methods offer great opportunities for control and behavior change, as well as to improve the client's understanding of the application. One of the consequences of this "finely ground" behavior is that there are usually many interactions between objects with a call to a variety of methods.

In the same address space, the “fine-milled” interactions work well, but everything changes when interaction between processes occurs. Remote calls are more costly, because a lot needs to be done: sometimes data needs to be streamlined, checked for security, packets must be routed on switches. If two processes work at different ends of the world, even the speed of light can play a role. The hard truth is that any interprocess communication is an order of magnitude more wasteful than an anutrocess calls. Even if both processes run on the same machine. Such an impact on performance cannot be overlooked, even by adherents of lazy optimization.

As a result, any object that is involved in remote interaction needs a more general interface that would minimize the number of requests needed to do something. This affects not only methods, but also objects. Instead of requesting an account and all its points separately, it is necessary to count and update all points of the account for one call. This affects the entire structure of the object. We must forget about the good purpose of small objects and small methods. Programming is becoming more difficult, productivity falls and falls.

The Remote Facade pattern is a common "Facade" (by GoF) on top of the structure of more "finely ground" objects. None of these objects has a remote interface, and Remote Facade does not include any business logic. All that Remote Facade does is translate general requests into a set of small requests to subordinate objects.

Data Transfer Object

Patterns of data distribution Remote Facade, Data Transfer Object

Data Transfer Object Design Pattern

Description Data Transfer Object

An object that transfers data between processes to reduce the number of method calls.

When working with a remote interface, such as, for example, Remote Facade, each request to it is quite expensive. As a result, you have to reduce the number of calls, which means that you need to transfer more data in one call. To implement this, as an option, you can use a lot of parameters. However, the code is often clumsy and inconvenient. It is also often not possible in languages ​​like Java, which return only one value.

The solution here is the Data Transfer Object pattern, which can store all the information you need to call. It must be serializable for easy network transfer. A collector object is typically used to transfer data between DTOs and objects in an application.

In the Sun community, many use the term "Value Object" to refer to this pattern. Martin Fowler means by this term (Value Object) a slightly different pattern. A discussion of this can be found in his book P of EEA on page 487.


Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Web site or software design

Terms: Web site or software design