Layered Architecture • Most commonly used of all architectures • Forms the basis of the modern paradigm of computing • Modules use services of the module(s) directly below it and provide services to the module(s) above it • Promotes loose coupling of cohesive modules • Often used as a "fallback" architecture when an obvious solution is not present • Other architectures can use this style, in a hybrid fashion Layered Architecture • Aqua Lush Example • LCD TV Example (Bai and Chen) High-Level Diagrams Wedding Cake Diagram Layer 5 Layer 4 Layer 3 Layer 2 Layer 1 Onion Diagram Layer 5 Layer 4 Layer 3 Layer 2 Layer 1 Wedding Cake Design is typically used to show connection between layers in communication protocols and user interfaces. Onion Diagram typically illustrates operating system layers. Communication • Static Structure: The software is partitioned into layers that provide a cohesive set of services with a well-defined interface. • Dynamic Structure: Each layer is allowed to only use the layer directly below it (Strict Layered style) all the layers below it (Relaxed Layered style) (Wedding Cake) Layered Architecture for Office Delivery Robots This example uses Strict Style. Four Main Layers Task Scheduling, Path Planning, Navigation and Obstacle Avoidance Task Scheduling determines how long all the routes will take (determine by asking Path Planner the length of each path). Path Planner creates paths the robot can take (Factoring in what navigation has said is possible). Navigation decides what paths can be taken to reach destination (Using data from Obstacle Avoidance). Obstacle Avoidance decides how to handle each obstacle the robot may run into. Advantages for the Layered Style • The layers can make great modules • Helps simplify the program by sub-dividing complex portions • Layers make use of the services provided by the layer below. • Layers provide services to the layer above • Satisfies the Principle of Cohesion • Layers are loosely coupled Advantages for the Layered Style • Supports information hiding • Layers help increase changeability, reusability, reliability, and maintainability • Changes can be made to certain layers and not the core functionality of the program • Systems can be easily ported to new platforms • Layers provide well-defined interfaces that can have reusable components The Problem with Overhead • Allocating information on a system with multiple sub-levels can become a problem in Layered Architecture design • Data that is passed through multiple layers can sometimes be changed due to the encryption and decryption of certain levels when either reading or writing information • Performance becomes an issue when traveling through multiple layers instead of accessing a component directly Restrictions to Layered Independence • Shared processes that are modified or added within higher layers must also be modified in the lower levels associated with the higher level • Modifying lower-level interfaces sometimes percolates to higher levels, commonly seen in a relaxed layered approach • Applications that require interface components can have longer standby times if the layers prevent them from accessing a database • Large applications can be controlled and encapsulated more effectively but this adds complexity to smaller systems • Satisfying an n amount of layers
© Copyright 2024