CSC 450 CSC450 Software Engineering Devon M. Simmonds University of North Carolina, Wilmington Some slides adapted from various sources 1 CSC 450 Outline Requirements Analysis Software Design Implementation Systems Engineering Evolution Deployment Testing This lecture will provide: An introduction to software architecture. A definition of software architecture Architectural styles Architecture as a process Architectural views Benefits of software architecture summary Software Design – bridging the gap between requirements & Implementation 2 CSC 450 Outline Requirements Analysis Software Design Implementation Systems Engineering Evolution Deployment Testing In this session we address: An introduction to software architecture. A definition of software architecture Architectural styles Architecture as a process Architectural views Benefits of software architecture Summary Software Design – bridging the gap between requirements & Implementation 3 CSC 450 What is Software Design? • Software design expresses a solution to a problem in programming language independent terms. – This permits a design to be implemented in any programming language. 4 Moving from problem to Architecture Requirements Spec Design Spec System attributes, anticipated changes, design constraints Design goals Use Cases Contracts Class Diagrams CSC 450 Architecture • subsystem structure • subsystem interfaces •etc. Other models 5 The Place of Architecture in Design Phases CSC 450 • Architectural Design – Identify subsystems and the services they provide – Describe interactions across subsystems • Subsystem Design: – Define classes – Describe how objects interact to accomplish subsystem services • Sequence diagrams, state machines, etc. • User Interface Design • Data structures/Database Design • Algorithm Design – Pre and post conditions • Test Case Design 6 UML Diagram Types for Architectural Design CSC 450 • Architectural Design – Package diagrams – Component diagrams – Deployment diagrams 7 CSC 450 Architecture defined Architecture n (1555) 1: the art or science of building; specifically: the art or practice of designing and building structures and esp. habitable ones. 2 a: formation or construction resulting from or as if from a conscious act <the architecture of the garden> b: a unifying or coherent form or structure <the novel lacks architecture> 4: a method or style of building. Merriam Webster’s Collegiate Dictionary 8 CSC 450 Can be built by one person Requires Minimal modeling Simple process Simple tools 9 CSC 450 Built most efficiently and timely by a team Requires Modeling Well-defined process Power tools 10 CSC 450 The more complex the problem the greater the need for: Teams of developers Modeling Well-defined processes Significant tool support 11 Computer Architecture CSC 450 is not Software Architecture • The assembly of logical elements into a computing device. • Specifying the relations between parts of a computer system. 12 CSC 450 What is Software Architecture? • (a model that) describes the overall structure of the software subsystems, the relationships among subsystems and the behavior of subsystems (i.e. how subsystems interact). A P K M B C 13 CSC 450 What are the goals of Software Architecture? • The goal of architectural design is to meet present and future demands on the architecture. A P K M B C 14 CSC 450 Software Architecture in UML • In UML, the architecture of a software may be described using: – Package diagrams – Component diagrams – Deployment diagrama 15 CSC 450 Outline Requirements Analysis Software Design Implementation Systems Engineering Evolution Deployment Testing In this session we address: An introduction to software architecture. A definition of software architecture Architectural styles Architecture as a process Architectural views Benefits of software architecture Summary Software Design – bridging the gap between requirements & Implementation 16 CSC 450 How do we go about creating an architecture for a system? • Exploring architectural Styles 17 Architectural Styles CSC 450 Architectural styles • An architecture style is a specification of how subsystems in a software may be organized. – Specification of architectural components – Specification of architectural connectors Component N Component N-1 – Specification of constraints on how components can be combined • Specification of component interaction (data exchange) – Specification of component configuration to form a system • Specification of one or more semantic models that specify how a system’s overall properties can be determined from the properties of its parts Component 2 Component 1 • Each architectural style defines a class of architectures. 18 CSC 450 Components & Connectors • What is an architectural component/subsystem? – A modular unit with well defined provided and required interfaces that is replaceable. Component N Component N-1 • What is an architectural connector? – A mechanism that mediates communication, coordination or cooperation among components. Component 2 Component 1 • e.g. remote procedure calls, message passing 19 Popular architecture styles CSC 450 • Layered • Client-server – Peer-to-peer • Model-view controller • Pipe and Filter • Shared Repository 20 CSC 450 Layered Architectures, cont. A Layered Architectural Style • Figure 2-1. Tanenbaum et al. 21 CSC 450 Rationale for Layered Architectures • Separate presentation and application logic, and other areas of concern. UI Layer “Domain” or “Application Logic” Layer Services Layer Persistence Subsystem Logging Subsystem ... 22 Layered Architectures, cont. CSC 450 Classical Three-Tiered Architecture • Figure 2-4 (Tanenbaum). The simplified organization of an Internet search engine into three different layers. 23 CSC 450 Layered Architectures, cont. Benefits of layered Architectures • Clear separation of parts/roles/subsystems. • Easy to plug and play components. • Relatively simple to implement as either a concurrent or sequential system. 24 24 Popular architecture styles CSC 450 • Layered • Shared Repository • Client-Server – Peer-to-peer • Model-view controller • Pipe and Filter 25 CSC 450 Shared repository architectures K A T • Multiple sub-systems share a common database. 26 CSC 450 Repository model characteristics • Advantages – Efficient way to share large amounts of data; – Sub-systems need not be concerned with how data is produced Centralised management e.g. backup, security, etc. – Sharing model is published as the repository schema. • Disadvantages – Sub-systems must agree on a repository data model. Inevitably a compromise; – Data evolution is difficult and expensive; – No scope for specific management policies; – Difficult to distribute efficiently. 27 Popular architecture styles CSC 450 • Layered • Shared Repository • Client-Server – Peer-to-peer • Model-view controller • Pipe and Filter 28 CSC 450 Client-server (“two-tier”) architectures • A network architecture in which each computer or process on the network is either a client or a server. 29 29 CSC 450 Architectural Styles •The client/Server Model Client invocation result Server invocation result Server Client Key: Proc ess : Computer: Fig. 2.2 Coulouris et al.: Clients invoke individual servers 30 Coulouris etal.Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000 Client/Server Model, cont. CSC 450 A service provided by multiple servers Servic e Server Client Server Client Server Fig. 2.3 Coulouris et al. 31 Coulouris etal.Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000 Client/Server Model, cont. CSC 450 Web proxy servers and caches Web s erver Client Proxy s erver Web s erver Client Fig. 2.4 Coulouris et al.: Web proxy servers 32 CSC 450 Peer-to-peer (P2P) architectures • Each network node has equivalent responsibilities – is both a client and a server. B A C 33 CSC 450 Coulouris etal.Distributed Systems: Concepts and Design Edn. 3 © Addison-Wesley Publishers 2000 Client/Server Model, cont. Client-server characteristics • Advantages – Distribution of data is straightforward; – Makes effective use of networked systems. May require cheaper hardware; – Easy to add new servers or upgrade existing servers. • Disadvantages – No shared data model so sub-systems use different data organisation. Data interchange may be inefficient; – Redundant management in each server; – No central register of names and services - it may be hard to find out what servers and services are available. 34 34 Popular architecture styles CSC 450 • Layered • Shared Repository • Client-Server – Peer-to-peer • Model-view controller • Pipe and Filter 35 The Model-view-controller architecture CSC 450 Data Functionality Model change notifies Controller query View change User Interface • Separates the application object (model) from • The way it is presented to the user (view), from • The way in which the user controls it (controller). 36 Popular architecture styles CSC 450 • Layered • Shared Repository • Client-Server – Peer-to-peer • Model-view controller • Pipe and Filter 37 Pipe and Filter architectures A K CSC 450 T • Input to one subsystem is processed and the output is passed to another subsystem for processing. • E.g. program compilation using the multi-phase translator architecture Compilation of a program is divided into – Lexical analysis » lex – Syntax analysis – Semantic analysis – optimization – Code generation » yacc – a tool for generating compilers 38 CSC 450 Pipe and Filter Characteristics • Advantages – Supports transformation reuse. – Intuitive organization for stakeholder communication. – Easy to add new transformations. – Relatively simple to implement as either a concurrent or sequential system. • Disadvantages – Requires a common format for data transfer along the pipeline and difficult to support event-based interaction. 39 CSC 450 Architecture styles Summary • An architecture style provides a standardized vocabulary for communication • An architecture style defines a family of systems sharing similar characteristics. • An awareness of these styles can simplify the problem of defining system architectures. • However, large systems are heterogeneous and may use a combination of architectural styles. 40 CSC 450 Architectural Design Process • • • • Identify potential subsystems Select architectural styles Arrange subsystems to fit architectural styles Identify subsystem dependencies 41 CSC 450 42 Architectural Design Exercise CSC 450 • Draw layered, client-server, shared repository and pipeand-filter architectures using this description – The BirdCage Corporation needs software to aid the management of its business. The corporation builds its business around domestic birds. BirdCage arranges its business around different services with each service being managed by a different company making BirdCage a group of companies. Companies are divided into departments. Services include veterinary services, safekeeping of birds, bird calisthenics and a bird competitions service. In order to streamline its business, BirdCage classifies the veterinary and safekeeping services as medical services. The other two services are regarded as entertainment services. In the future the company hopes to add a number of “Nutritional” services to address the production and sales of food for birds. The corporation classifies birds as either exotic or non-exotic. BirdCage does not provide entertainment services for exotic birds. Owls and crows are non-exotic birds, while macaws, cockatoos and green quakers are exotic. BirdCage seeks to maintain a minimum stock of at least 10 of each type of exotic bird. 43 CSC 450 Outline Requirements Analysis Software Design Implementation Systems Engineering Evolution Deployment Testing In this session we address: An introduction to software architecture. A definition of software architecture Architectural styles Architecture as a process Architectural views Benefits of software architecture Summary Software Design – bridging the gap between requirements & Implementation 44 Mary Shaw, CMU Grady Booch, Philippe Kruchten, Rich Reitman Kurt Bittner, Rational CSC 450 Architecture as a process • Software architecture encompasses the set of significant decisions about the organization of a software system – selection of the structural elements and their interfaces by which a system is composed – behavior as specified in collaborations among those elements – composition of these structural and behavioral elements into larger subsystem – architectural style that guides this organization • The output of this design process is a description of the software architecture. 45 CSC 450 Outline Software Design Requirements Analysis Implementation Systems Engineering Evolution Deployment Testing In this session we address: An introduction to software architecture. A definition of software architecture Architectural styles Architecture as a process Architectural views Benefits of software architecture Summary Software Design – bridging the gap between requirements & Implementation 46 CSC 450 Many stakeholders, many views • Architecture is many things to many different interested parties – – – – – – customer project manager architect developer maintainer etc. • Multiple stakeholders many views 47 CSC 450 Architectural view • An architectural view is a simplified description (an abstraction) of a system from a particular perspective or vantage point, covering particular concerns, and omitting entities that are not relevant to this perspective. 48 CSC 450 A model is a complete description of a system from a particular perspective Models, Views, and Diagrams Use Case Use Case Diagrams Use Case Diagrams Diagrams State State Diagrams Class Diagrams Diagrams State State Diagrams Object Diagrams Diagrams Use Case Use Case Diagrams Sequence Diagrams Diagrams Scenario Scenario Diagrams Collaboration Diagrams Diagrams Scenario Scenario Diagrams Statechart Diagrams Diagrams State State Diagrams Component Diagrams Diagrams Models Component Component Diagrams Deployment Diagrams Activity Diagrams Diagrams 49 CSC 450 Diagrams • A diagram is a view into a model – Presented from the aspect of a particular stakeholder – Provides a partial representation of the system – Is semantically consistent with other views • UML diagrams – Static views: use case, class, object, component, deployment – Dynamic views: sequence, statechart, activity 50 CSC 450 The 4 + 1 View Model – Philippe Kruchten(95) Development view Logical view Programmers Software management End-user Functionality . Use case view Process view System integrators: Performance, Scalability, Throughput Conceptual Physical view System topology, Delivery, installation Physical 51 CSC 450 Example Logical Architecture bill order Customer Care Accounts Receivables System Static Structural Diagram invoice Order Processing customer update Domain query order order update 52 Deployment Diagram CSC 450 • Captures the topology of a system’s hardware 53 CSC 450 Outline Requirements Analysis Software Design Implementation Systems Engineering Evolution Deployment Testing In this session we address: An introduction to software architecture. A definition of software architecture Architectural styles Architecture as a process Architectural views Benefits of software architecture summary Software Design – bridging the gap between requirements & Implementation 54 CSC 450 Advantages of explicit architecture • Stakeholder communication – Architecture may be used as a focus of discussion by system stakeholders. • System analysis – Means that analysis of whether the system can meet its non-functional requirements is possible. • Large-scale reuse – The architecture may be reusable across a range of systems. 55 Architecting system characteristics CSC 450 Performance Localize critical operations and minimize communications. Use large rather than fine-grain components. Security Use a layered architecture with critical assets in the inner layers. Safety Localize safety-critical features in a small number of sub-systems. Availability Include redundant components and mechanisms for fault tolerance. Maintainability Use fine-grain, replaceable components. 56 CSC 450 Outline Requirements Analysis Software Design Implementation Systems Engineering Evolution Deployment Testing In this session we address: An introduction to software architecture. A definition of software architecture Architectural styles Architecture as a process Architectural views Benefits of software architecture Summary Software Design – bridging the gap between requirements & Implementation 57 Summary CSC 450 Architectural design decisions • • • • • • • • Is there a generic application architecture that can be used? How will the system be distributed? What architectural styles are appropriate? What approach will be used to structure the system? How will the system be decomposed into modules? What control strategy should be used? How will the architectural design be evaluated? How should the architecture be documented? 58 Summary CSC 450 Key points • The software architecture is the fundamental framework for structuring the system. • Architectural design decisions include decisions on the application architecture, the distribution and the architectural styles to be used. • Different architectural models such as a structural model, a control model and a decomposition model may be developed. • System organisational models include repository models, client-server models and pipe-and-filter models. 59 CSC 450 The End Qu es ti ons? ______________________ Devon M. Simmonds Computer Science Department University of North Carolina Wilmington _____________________________________________________________ 60 Architectural Design Exercise CSC 450 • Draw layered, client-server, shared repository and pipeand-filter architectures using this description – The Exotic Sunshine Corporation needs software to aid the management of its business. The corporation is made up of several different companies each having at least three divisions. The corporation classifies divisions as either production, sales or marketing. The sales and marketing divisions are given jurisdiction for a specific geographic region. This region must include the company that owns the division. Regions have managers, however, an employee may only manage two or more regions if he/she has in excess of ten years experience with the company, or ten years in a comparable position. Managers with more than ten years service and managers in the head office are allowed thirty days of paid vacation per year. In addition, they may have up to three company vehicles assigned and one of the vehicles may be a luxury vehicle. Other managers are not allowed luxury vehicles and cannot be allocated in excess of one vehicle. The corporation manufactures and sells boats, electronic equipment, fruit juices and paper. 61