Layering

zhaozj2021-02-16  159

Layering is one of the most common techniques that software designers use to break apart a complicated software system. You see it in machine architectures, where layers descend from a programming language with operating system calls into device drivers and CPU instruction sets, and into logic gates INSIDE Chips. Networking has ftp layered on top of tcp, Which is on top of ip, Which is on top of ethernet.

When thinking of a system in terms of layers, you imagine the principal subsystems in the software arranged in some form of layer cake, where each layer rests on a lower layer. In this scheme the higher layer uses various services defined by the lower layer, but the lower layer is unaware of the higher layer. Furthermore, each layer usually hides its lower layers from the layers above, so layer 4 uses the services of layer 3, which uses the services of layer 2, but layer 4 is unaware of layer 2. (Not All Layering Architectures Are Opaque Like this, But Most Are 梠 R Rather Most Are Mostly Opaque.

Breaking Down A System Into Layers Has A Number of Important Benefits.

You can understand a single layer as a coherent whole without knowing much about the other layers. You can understand how to build an FTP service on top of TCP without knowing the details of how ethernet works. You can substitute layers with alternative implementations of the same basic services. An FTP service can run without change over ethernet, PPP, or whatever a cable company uses. You minimize dependencies between layers. If the cable company changes its physical transmission system, providing they make IP work, we do not have to alter our FTP service. Layers make good places for standardization. TCP and IP are standards because they define how their layers should operate. Once you have a layer built, you can use it for many higher-level services. Thus, TCP / IP is Used by ftp, telnet, ssh, and http. Otherwise, All of these Higher-Level Protocols Would Have to Write Their OWN Lower-Level Protocols.Layering IS An Important Technique, But There Are Downsides.

Layers encapsulate some, but not all, things well. As a result you sometimes get cascading changes. The classic example of this in a layered enterprise application is adding a field that needs to display on the UI, must be in the database, and thus must be added to every layer in between. Extra layers can harm performance. At every layer things typically need to be transformed from one representation to another. However, the encapsulation of an underlying function often gives you efficiency gains that more than compensate. A layer That Controls Transactions Can Be Optimized and Will The Make Everything Faster.

.

转载请注明原文地址:https://www.9cbs.com/read-8683.html

New Post(0)