Software Architecture Frank Tsui, Orland Karam, and Barbara Bernal, Essential of Software Engineering, 3rd edition, Jones & Bartett Learning. Section 7.2. Hans Van Vliet, Software Engineering, Principles and Practice, 3rd edition, John Wiley & Sons, 2008. Chapter 11. M. Shaw and D. Garlan, Software Architecture: Perspectives on an Emerging Discipline, Prentice Hall, 1996. CS 4311 Learning Objectives To understand the concept of software architectures along with its motivation To be able to characterize some important software architecture styles CS 4311 2 Outline What’s software architecture? Elements of software architecture Architectural styles CS 4311 3 Architecture in Civil Engineering Design at the highest level Example: Bridge architectures Arch CS 4311 Beam Suspension Cable-stayed 4 Architecture in Civil Engineering Design at the highest level Why do civil Example: Bridge architectures engineers talk about bridge architectures? Arch CS 4311 Beam Suspension Cable-stayed 5 What Is Architecture? “Arch” used as prefix or suffix Definition in Civil Engineering Meaning: Main, chief, principal, most important, highest, fundamental, basic, extreme or most characteristic, ruler, leader Examples: Archangel, archenemy, archduke, archbishop Matriarch, patriarch, monarch The art and science of designing and erecting buildings Fundamental underlying design of buildings Style and method of design and construction of buildings Buildings and other structures CS 4311 6 What Is Software Architecture? Framework, mechanism, way, shape, form, means, organization, arrangement The Big Picture! CS 4311 7 Software Architecture The structure or structures of a software system software components externally visible properties of those components the relationships between them The set of principle design decisions made about a software system CS 4311 System structure Functional behavior Interaction Nonfunctional properties Implementation System goals, stakeholders, non-technical considerations, etc. 8 Outline What’s software architecture? Elements of software architecture Architectural styles CS 4311 9 Elements of Software Architecture Components Connectors Configuration topologies System models CS 4311 10 Software Components Elements that encapsulate processing and data in a system’s architecture An architectural entity that encapsulates a subset of the system’s functionality and/or data, restricts access to that subset via an explicitly defined interface, and had explicitly defined dependencies on its required execution context. Often represented as boxes in diagrams. CS 4311 11 Connectors Elements that are tasked with effecting and regulating interactions among components. Application independent. Often represented as lines in diagrams. component connector CS 4311 12 Configuration Topology • A set of specific associations between the components and connectors of a software system’s architecture. CS 4311 13 System Models An artifact that captures some or all of the design decisions that comprise a system’s architecture. Architectural modeling is the reification and documentation of those design decisions. Different models: structural vs. behavioral static vs. dynamic Scope Q: Key constraints of layered model? CS 4311 14 Outline What’s software architecture? Elements of software architecture Architectural styles CS 4311 15 Architectural Styles A named collection of architectural design decisions that: are applicable in a given development context, constrain architectural design decisions that are specific to a particular system with that context, and elicit beneficial qualities in each resulting system. Not about: specific systems, components, interaction mechanisms, or configurations. CS 4311 16 An Architectural Style Example Physically separate the software components used to request services from the components that provide the services, to allow for proper distribution and scaling up, both in the number of service providers and service requesters. Make the service providers unaware of the requesters’ identity to allow the providers to service transparently many, possibly changing requestors. Insulate the requesters from one another to allow for their independent addition, removal, and modification. Make the requesters dependent only on the service providers. Allow for multiple service providers to emerge dynamically to offload the existing providers should the demand for services increase above a given threshold. CS 4311 17 Example: Client-Server CS 4311 18 More on Architectural Styles Advantages Each style emphasizes one or more of the quality attributes, such as usability, availability, security, performance, maintainability, flexibility, portability, etc. Remarks: CS 4311 Each style has its own advantages and drawbacks. An application may require several architectural views. Choosing the right views is a key factor in having a good design. 19 The Repertoire of Architecture Styles Client-Server Architecture Style Application context: Clients request services from a server Centralization of computation and data at the server Separation of user interface tasks from computation and data management and storage Q: Any examples? CS 4311 20 Style: Client-Server Components: Clients and server Connectors: Remote procedure call, network protocols Data elements: Parameters and return values are sent by the connectors Topology: Two-level, with multi-clients Qualities yielded: Centralization of computation and data at the server, with the information made available to remote clients. A single powerful server can service many clients. Cautions: Network bandwidth. CS 4311 21 Style: Three-Tier or N-Tier Application context: Client-Server architecture style Multi-level services are needed Q: Examples? CS 4311 22 Style: Layered Application context: Ordered layered services are necessary Insulate upper layer from lower layer Q: Examples? CS 4311 23 Layered (Cont.) Components: Layers, offering a set of services to other layers, typically comprising several programs or subprograms Connectors: Procedure call Data elements: Parameters and return values are sent by the connectors Topology: Linear, for strict virtual machine; a directed acyclic graph in looser interpretations Qualities yielded: Clear dependence structure; Software at upper levels immune to changes of implementation within lower levels as long as the service specification are invariant; Software at lower levels fully independent of upper levels. Cautions: Efficiency CS 4311 24 Style: Repository Application context: Collaborate and communicate through a shared repository A.k.a. shared state, blackboard, whiteboard Q: Examples? CS 4311 25 Repository (Cont.) Components: ? Connectors: ? Data elements: ? Topology: ? Qualities yielded: ? Cautions: ? CS 4311 26 Style: Batch Sequential Application context: A series of dedicated and independent components that transforms data in a sequential manner. Each component needs to finish its task before the next one can start. Q: Examples? CS 4311 27 Batch Sequential (Cont.) Components: Independent programs responsible for a particular task or transformation Connectors: Procedure call Data elements: Intermediate data produced or transformed Topology: Linear or ordered Qualities yielded: Solve complex task by dividing it into several easier tasks; obtain modifiability/maintainability, reusability, and flexibility Cautions: Error handling; efficiency CS 4311 28 Style: Pipes and Filters Application context: A series of independent, sequential transformations on ordered data Consists of filters transforming data and pipes transferring data Q: Examples? % ps | grep bash | sort | more CS 4311 29 More Architectural Styles Client server Three-tier Layered Repository Batch sequential Pipe and filter CS 4311 Event driven Interpreter Peer-to-peer Plug-in Service-oriented Publish-subscribe Rule-based Mobile code … 30 In-Class and Assignment: Study two architectural styles per team Prepare a 10-minute presentation for the next class You will present: CS 4311 What is it? What problem does it solve? How does it solve the problem? Who are the actors (i.e., main elements)? How do they relate to each other? What’re the strengths and drawbacks? Example applications? Include your sources (e.g., websites) 31