Roadmap What is Software Architecture style? Description Layered architectural style Description Advantages Disadvantages Examples
Description An architectural style or pattern is: a description of the component and connector types involved in the style the collection of rules that constrain and relate them
Layered Pattern A layered architecture organizes a system into a set of layers each of which provide a set of services to the layer “ above ” . Layering consists of a hierarchy of layers, each providing service to the layer above it and serving as client to the layer below . Supports the incremental development of sub-systems in different layers. When a layer interface changes, only the adjacent layer is affected
Layered Pattern Context While working with a large, complex system and you want to manage complexity by decomposition . Problem How do you structure an application to support such important requirements as maintainability, scalability, extensibility, robustness, and security ? Solution Compose the solution into a set of layers. Each layer should be cohesive and at roughly the same level of abstraction. Each layer should be loosely coupled to the layers underneath.
Interaction between layers(1) Interactions among layers are defined by suitable communication protocols . Interactions among non-adjacent layers must be kept to the minimum possible . Normally layers are constrained so elements only see: other elements in the same layer, or elements of the layer below
Interaction between layers(2) Flow requests from higher layer to lower layer answers from lower layer to higher layer ( callbacks ) incoming data or event notification from low to high
Advantages(1) Independence Different components of the application can be independently deployed, maintained, and updated, on different time schedules Makes possible for team members to work in parallel on different parts of the application with minimal dependencies . Testing the components independently of each other.
Advantages(2) More secure Each layer may hide private information from other layers Reusability Each layer, being cohesive and is coupled only to lower layers, makes it easier for reuse by others and easier to be replaced or interchanged
Advantages(3) Reusing components easily: For example if we want a windows user interface rather than a web browser interface, this can be done in an easy and fast way by just replacing the UI component. All the other components like business logic, data access and the database remains the same. Layered architecture allows to swap and reuse components at will . I n creases flexibility, maintainability, and scalability : W e separate the user interface from the business logic, and the business logic from the data access logic.
Disadvantages Performance degrades if we have too many layers (extra overhead of passing through layers and also changes will pass slowly to higher layers ) Sometimes difficult to cleanly assign functionality to the “ right ” layer Can’t be used for simple applications because it adds complexity.
Examples Virtual Machines APIs Information systems – lower layer is database Presentation Application logic Domain layer Database Some operating systems – Windows NT
Example 1 : Layered Architecture for OS (Sample) Resource (I/ O , network, file, etc.) management Utilities (editors, sys commands, compilers , internet access, libraries, etc.) Kernel (Device & memory Processing) drivers Process (classification & management)
Example 2 : Java VM Java Virtual Machine Processor Operating System Java Virtual Machine Java Application