1 / 50

System Design

TUM. System Design. 2. Bernd Brügge Technische Universität München Applied Software Engineering 30 November 2004. Design. “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies,

kenyon-lane
Download Presentation

System Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TUM System Design 2 Bernd Brügge Technische Universität München Applied Software Engineering 30 November 2004

  2. Design “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies.” - C.A.R. Hoare

  3. Why is Design so Difficult? • Analysis: Focuses on the application domain • Design: Focuses on the solution domain • Design knowledge is a moving target • The reasons for design decisions are changing very rapidly • Halftime knowledge in software engineering: About 3-5 years • What I teach today will be out of date in 3 years • Cost of hardware rapidly sinking • Design window: Time in which design decisions have to be made

  4. New System The Scope of System Design Problem • Bridge the gap • between a problem and an existing system in a manageable way • Use Divide and Conquer • Model the new system as a set of subsystems Existing System

  5. 8. Boundary Conditions 1. Design Goals Definition Trade-offs Initialization Termination Failure 2. Subsystem Decomposition 7. Software Control Layers vs Partitions Coherence/Coupling Monolithic Event-Driven Conc. Processes 3. Concurrency 4. Hardware/ Software Mapping 5. Data Management 6. Global Resource Handlung Identification of Threads Special Purpose Buy vs Build Allocation of Resources Connectivity Access Control List vs Capabilities Security Persistent Objects Filesystem vs Database System Design addresses 8 Areas System Design

  6. Overview System Design I (Today) 0. Overview of System Design 1. Design Goals 2. Subsystem Decomposition System Design II (next lecture) 3. Concurrency 4. Hardware/Software Mapping 5. Persistent Data Management 6. Global Resource Handling and Access Control 7. Software Control 8. Boundary Conditions

  7. How the Results from Requirements Analysis influence System Design 11/30/2004 • Nonfunctional Requirements => Definition of Design Goals • Functional model => Subystem Decomposition (Selection of subsystems based on functional requirements, coherence, and coupling) • Object model => Hardware/software Mapping and Data Management (Persistent objects) • Dynamic model => Identification of Concurrency, Global Resource Handling, Software Control • Finally: From the Subsystem Decomposition => Boundary conditions

  8. 8. Boundary Conditions 1. Design Goals Definition Trade-offs Initialization Termination Failure 2. System Decomposition 7. Software Control Layers vs Partitions Coherence/Coupling Monolithic Event-Driven Conc. Processes 3. Concurrency 4. Hardware/ Software Mapping 5. Data Management 6. Global Resource Handlung Identification of Threads Special Purpose Buy vs Build Allocation of Resources Connectivity Access Control List vs Capabilities Security Persistent Objects Filesystem vs Database From Analysis to System Design Functional Model Nonfunctional Requirements Functional Model Dynamic Model Dynamic Model Object Model

  9. Example of Design Goals • Good documentation • Well-defined interfaces • User-friendliness • Reuse of components • Rapid development • Minimum number of errors • Readability • Ease of learning • Ease of remembering • Ease of use • Increased productivity • Low-cost • Flexibility • Reliability • Modifiability • Maintainability • Understandability • Adaptability • Reusability • Efficiency • Portability • Traceability of requirements • Fault tolerance • Backward-compatibility • Cost-effectiveness • Robustness • High-performance

  10. Functionality User-friendliness Ease of Use Ease of learning Fault tolerant Robustness Low cost Increased Productivity Backward-Compatibility Traceability of requirements Rapid development Flexibility End User Minimum # of errors Modifiability, Readability Reusability, Adaptability Well-defined interfaces Developer/ Maintainer Relationships Between Design Goals Nielson Usability Engineering Rubin Task Analysis Runtime Efficiency Reliability Portability Good Documentation Client (Customer)

  11. Typical Design Trade-offs • Functionality vs. Usability • Cost vs. Robustness • Efficiency vs. Portability • Rapid development vs. Functionality • Cost vs. Reusability • Backward Compatibility vs. Readability

  12. Nonfunctional Requirements give a clue for the use of Design Patterns • Read the problem statement again • Use textual clues (similar to Abbot’s technique in Analysis) to identify design patterns • Text: “manufacturer independent”, “device independent”, “must support a family of products” • Abstract Factory Pattern • Text: “must interface with an existing object” • Adapter Pattern • Text: “must deal with the interface to several systems, some of them to be developed in the future”, “ an early prototype must be demonstrated” • Bridge Pattern

  13. Textual Clues in Nonfunctional Requirements • Text: “complex structure”, “must have variable depth and width” • Composite Pattern • Text: “must interface to an set of existing objects” • Façade Pattern • Text: “must be location transparent” • Proxy Pattern • Text: “must be extensible”, “must be scalable” • Observer Pattern • Text: “must provide a policy independent from the mechanism” • Strategy Pattern

  14. Section 2. Subsystem Decomposition • Subsystem • Collection of classes, associations, operations, events and constraints that are closely interrelated with each other • The objects and classes from the object model are the “seeds” for the subsystems • In UML subsystems are modeled as packages Two additional terms: • Service • Group of operations provided by the subsystem • Subsystem Interface • Set of fully typed related operations

  15. Services, Subsystem Interfaces and APIs • Service: • A set of related operations that share a common purpose • “Seed” for services: Subsystem use cases • Services are defined during System Design • Subsystem Interface: Set of fully typed related operations • Specifies the interaction and information flow from and to subsystem boundaries, but not inside the subsystem • Refinement of Services, should be well-defined and small • Subsystem Interfaces are defined in Object Design • Application programmer’s interface (API) • The application programmers interface is the specification of the subsystem interface in a specific programming language • The terms Subsystem Interface and API are often confused with each other • The term API shouldnot be used during System Design, but only during Implementation

  16. Tournament Component Management User Management Tournament Statistics User Directory User Interface Session Management Advertisement ARENA Subsystemdecomposition

  17. Tournament Component Management User Management Tournament Statistics User Directory User Interface Session Management Advertisement Services provided by the ARENA Subsystems Manages advertisement banners and sponsorships. Administers user accounts Manages tournaments, applications, promotions. For adding games, styles, and expert rating formulas Stores user profiles (contact & subscriptions) Stores results of archived tournaments Maintains state during matches.

  18. Coupling and Coherence • Goal: Reduction of complexity while change occurs • Coherence measures the dependence among classes • High coherence: The classes in the subsystem perform similar tasks and are related to each other (via associations) • Low coherence: Lots of miscellaneous and auxiliary classes, no associations • Coupling measures the dependencies between subsystems • High coupling: Changes to one subsystem will have high impact on the other subsystem (model change, massive recompilation,…) • Low coupling: A change in one subsystem does not affect any other subsystem • A good subsystem decomposition has maximum coherence and minimum coupling: • How can we achieve high coherence? • How can we achieve low coupling?

  19. Questions to Select Subsystems • Achieving high coherence: Most of the interaction should be within subsystems, rather than across subsystem boundaries • Does one subsystem always call the other for the service? • Which of the subsystems call each other for service? • Primary Question: • What kind of service is provided by the subsystems (subsystem interface)? • Secondary Question: • Can the subsystems be hierarchically ordered (in layers)? • What kind of model is good for describing layers and partitions?

  20. Modeling Authoring Workorder Repair Inspection Augmented Reality Workflow Example of a Bad Decomposition Too much “ravioli”

  21. Alternative Design: The System STARS as Set of Interface Objects Authoring Modeling Workflow Augmented Reality Inspection Repair Workorder The Subsystem Interface Objects publish the service (= Set of public operations) provided by the subsystem

  22. Subsystem Interface Object • Subsystem Interface Object • The set of public operations provided by the subsystem • The Subsystem interface describes all the operations of the subsystem interface object • We will use the Facade design pattern to model the subsystem interface object

  23. Repair Inspection Authoring Augmented Reality Workflow Modeling Another Design: STARS as set of Layers What is the relationship between Modeling and Authoring? Are additional subsystems needed?

  24. Layers and Partitions A large system is usually decomposed into subsystems using both, layers and partitions Layering and partitioning are techniques to achieve low coupling • Informational defition: A layeris a subsystem that provides a service to another layer • A layer only depends on lower layers • A layer has no knowledge of higher layers • Another term for layer is level of abstraction • A partition divides a system vertically into several independent (“weakly coupled”) subsystems that provide services on the same level of abstraction

  25. Subsystem Decomposition into Layers Layer relationship Partition relationship Subsystem Decomposition Heuristics - No more than 7+/-2 subsystems • More subsystems increase coherence but also complexity (more services) - No more than 4+/-2 layers • Try to find 3 layers Layer 1 Layer 2 Layer 3

  26. Layer and Partition Relationships • Layer relationship • Layer A “Calls” Layer B (runtime property) • Layer A “Depends on” Layer B (compile time property) • Example: “make” dependency • Partition relationship • Example: Partition A “Calls” partition B and partition B “Calls” partition A • The subsystem have mutual but not deep knowledge about each other

  27. C1 C1 C1 attr attr attr opr opr opr C1 C1 attr attr opr opr C1 C1 attr attr opr opr C1 attr opr Virtual Machine (Dijkstra, 1965, T.H.E.) • A system should be developed by an ordered set of virtual machines, each built in terms of the ones below it. Problem Virtual Machine 4 Virtual Machine 3 Virtual Machine 2 Virtual Machine 1 Existing System

  28. Virtual Machine • A virtual machine is an abstraction that provides a set of attributes and operations. • A virtual machine is a subsystem connected to higher and lower level virtual machines by "provides services for" associations. • The terms layer and virtual machine can be used interchangeably. • Virtual machines can implement two types of software architecture: closed and open architectures.

  29. C1 C1 C1 C1 C1 C1 C1 C1 C1 VM1 attr attr attr attr attr attr attr attr attr op op op op op op op op op VM2 VM3 VM4 Closed Architecture (Opaque Layering) • A virtual machine can only call operations from the layer below • Design goal: High maintainability, flexibility

  30. C1 C1 C1 C1 C1 C1 C1 C1 C1 attr attr attr attr attr attr attr attr attr op op op op op op op op op Open Architecture (Transparent Layering) 12/1/2004 • A virtual machine can call operations from any layers below • Design goal: Runtime efficiency VM1 VM2 VM3 VM4

  31. A: Debugger D: File System G: Operating System Properties of Layered Systems • Layered systems are hierarchical. They are desirable because hierarchy reduces complexity (by low coupling) • Closed architectures are more portable • Open architectures are more efficient • Layered systems often have a chicken-and egg problem • Example: Debugger trying to open the symbol table when the file system is being debugged

  32. Architectural Style and Software Architecture • Subsystem decomposition • Identification of subsystems, services, and their relationship to each other. • Specification of the system decomposition is critical • Architectural Style: A pattern for subsystem decomposition • Many architectural styles (Chapter 6, p. 237) • Client/Server • Peer-To-Peer • Repository • Model//View/Controller • Three-tier, Four-tier (Only in the book) • Pipes and Filters (Only in the book) • Software Architecture: An instance of an architectural style

  33. Server * * Client +service1() requester provider +service2() +serviceN() Client/Server Architectural Style • One or many servers provides services to instances of subsystems, called clients • Each client calls on the server, which performs some service and returns the result • The clients know the interface of the server (its service) • The server does not need to know the interface of the client • The response in general is immediately • End users interact only with the client

  34. Client/Server Architectures • Often used in the design of database systems: • Front-end: User application (client) • Back end: Database access and manipulation (server) • Functions performed by client: • Customized user interface • Front-end processing of data • Initiation of server remote procedure calls • Access to database server across the network • Functions performed by the database server: • Centralized data management • Data integrity and database consistency • Database security • Concurrent operations (multiple user access) • Centralized processing (for example archiving)

  35. Design Goals for Client/Server Systems • Service Portability • Server should be installable on a variety of operating systems and should work in a variety of networking environments • Location-Transparency • The server might itself be distributed (why?), but should provide a single "logical" service to the user • Performance • Client should be customized for interactive display-intensive tasks • Server should provide CPU-intensive operations • Scalability • Server should have spare capacity to handle large number of clients • Flexibility • The system should be usable for a variety of user interfaces and end devices (eg. PDA, Handy, laptop, wearable computer) • Reliability • System should survive individual client and communication link problems

  36. Problems with Client/Server Architectures • Layered systems do not provide peer-to-peer communication • Peer-to-peer communication is often needed • Example: • Database must process queries from application and should be able to send notifications to the application when data have changed

  37. Peer Client Server 1. updateData application1:DBUser database:DBMS application2:DBUser 2. changeNotification Peer-to-Peer Architectural Style • Clients can be servers and servers can be clients • More difficult because of possibility of deadlocks • Generalization of Client/Server Architecture

  38. Application Presentation Session Transport Network DataLink Physical Example of a Peer-to-Peer Architecture • ISO’s OSI Reference Model • ISO = International Standard Organization • OSI = Open System Interconnection • Reference model defines 7 layers of network protocols and strict methods of communication between the layers • Closed software architecture Level of abstraction

  39. OSI Model Layers and their Responsibility • The Physical layer represents the hardware interface to the network. It provides operations send() and receivebits over a channel • The Datalink layerallows to send and receive frames without error • The Network layer ensures that the data are transmitted and routed within the network • The Transport layeris responsible for reliably transmitting messages (This is the interface seen by Unix programmers when transmitting over TCP/IP sockets) • The Session layer is responsible for initializing a connection, including authentication • The Presentation layer performs data transformation services, such as byte swapping and encryption • The Application layer is the system you are designing (unless you build a protocol stack) • The application layer is usually layered itself

  40. Presentation Presentation Session Session Bidirectional associa- tions for each layer Transport Transport Network Network Data Link Data Link Physical Physical Processor 1 Processor 2 The Application Layer Provides the Abstractions of the “New System” Application Application

  41. Layer 1 Layer 2 Layer 1 Layer 2 Layer 3 Layer 3 Layer 4 Application Layer Application Layer Presentation Layer Presentation Layer Session Layer Session Layer Bidirectional associa- tions for each layer Transport Layer Transport Layer Network Layer Network Layer Data Link Layer Data Link Layer Physical Physical Processor 1 Processor 2

  42. An Object-Oriented View of the OSI Model • The OSI Model is a closed software architecture (i.e., it uses opaque layering) • Each layer can be modeled as a UML package containing a set of classes available for the layer above

  43. Object CORBA Socket TCP/IP Ethernet Wire Middleware Allows You To Focus On The Higher Layers Application Presentation Session Transport Network DataLink Physical

  44. Repository Subsystem createData() setData() getData() searchData() Repository Architectural Style • Subsystems access and modify data from a single data structure called the repository • Also called blackboard architecture • Subsystems are loosely coupled (interact only through the repository) • Control flow is dictated by central repository through triggers or by the subsystems through locks and synchronization primitives • The first blackboard architecture was realized in the Hearsay II Speech Recognition System at Carnegie Mellon

  45. Compiler SemanticAnalyzer SyntacticAnalyzer Optimizer CodeGenerator LexicalAnalyzer Repository SymbolTable ParseTree SourceLevelDebugger SyntacticEditor Examples of Repository Architectures • Hearsay II speech understanding system (“Blackboard architecture”) • Database Management Systems • Modern Development Environments (Eclipse, …)

  46. 1 repository View initiator Controller * Model 1 notifier subscriber * Model /View/ Controller Architectural Style: MVC • Subsystems are classified into 3 different types • Model subsystem: Responsible for application domain knowledge • View subsystem: Responsible for displaying application domain objects to the user • Controller subsystem: Responsible for sequence of interactions with the user and notifying views of changes in the model • The MVC style is a special case of the repository architectural style: • Model subsystem implements the Repository, the Controller subsystem explicitly dictates the control flow • Example: Filesystem based on MVC

  47. 3 Views of the name of this presentation 3 Possibilities to change the name Whathappens? List View Powerpoint View Info View

  48. 2.User types new filename 3. Request name change in model 5. Updated views 4. Notification of subscribers :InfoView :FolderView :PowerpointView Sequence of Events (UML Collaboration Diagram) :Controller 1. Views subscribe to event :Model

  49. Observable addObserver() deleteObserver() notifyObservers() Observer update() * Subject -filename InfoView update() getState() setState() ListView update() PowerpointView update() Class Diagram Class Diagram (Observer Pattern) View Model

  50. Summary • System Design • An activity that reduces the gap between the problem and an existing (virtual) machine • Decomposes the overall system into manageable parts by using the principles of cohesion and coherence • Design Goals Definition • Describes and prioritizes the qualities that are important for the system • Defines the value system against which options are evaluated • Subsystem Decomposition • Results into a set of loosely dependent parts which make up the system • Architectural Style • A pattern of a typical subsystem decomposition • Software architecture • An instance of an architectural style

More Related