Parameter transfer in layer-3 Architecture
Parameters in a three-tier architecture are frequently transmitted and important. however, parameter transfer is divided into many cases. although there are many cases, we do not divide them by form much. Generally, we use values and transfer entities. the following is a brief introduction.
When the data center charging system is used, the administrator ID needs to be used multiple times by different forms after the Administrator logs in, the administrator ID needs to be passed multiple times. at this time, there are two processing methods. One is to define global variables in the form and then call other forms. If it is called by another layer, the layer name must be added. the other is to create a module, and then create a global variable in the module. assign a value to the global variable as needed and read the global variable as needed. of course, this is basically passing values. if there are many values, you can also pass arrays and collections.
Transferring objects may be more typical in a three-tier architecture. If we look at the package chart, we may know that each layer will add references to the Object layer. the so-called object transfer is to assign the value to be passed (most of the values of different types here) to the attributes of the instantiated object class, and then call the method, place the object in the parameter section of the method to transfer the object.
Here, both passing values and passing objects have their own advantages and disadvantages. Passing values is simple and not complex. it is easy to maintain object transfer. however, the value transfer is somewhat different from the object-oriented concepts and ideas. however, we don't want to do things in line with certain ideas and ideas, but how can we accomplish what we want more effectively? If we need a card number, it is enough to pass the value directly, we do not need to create a very bloated entity class, and then instantiate the object.
However, when a parameter is returned, it will be directly transmitted back to dataset or able. This transfer may also be a little different from the object-oriented idea, but in the same way, we don't turn into a theory, but efficiency. of course, the data transmitted back to dataset and able is mainly for convenience, and also for the singleton and simplicity of the class functions. if dataset and able are given to the object, it may be messy and troublesome.
There is nothing to say about the choice of parameter form. The right one is the best, not to hide the truth.