Overview. Software Design Principles and Guidelines 9/16/08. Adam Porter Sept. 16, Design Principles. Design Guidelines

Similar documents
Software Design Principles and Guidelines

Software Quality Factors OOA, OOD, and OOP Object-oriented techniques enhance key external and internal software quality factors, e.g., 1. External (v

Fourth generation techniques (4GT)

Object Oriented Design

How To Develop Software

The Phases of an Object-Oriented Application

Engineering Process Software Qualities Software Architectural Design

KWIC Exercise. 6/18/ , Spencer Rugaber 1

Glossary of Object Oriented Terms

Software Design Principles and Guidelines

Software Engineering

Quotes from Object-Oriented Software Construction

Functional Decomposition Top-Down Development

Software Paradigms (Lesson 1) Introduction & Procedural Programming Paradigm

Design by Contract beyond class modelling

Module 1. Introduction to Software Engineering. Version 2 CSE IIT, Kharagpur

Patterns in Software Engineering

Data Abstraction and Hierarchy

Aspect-Oriented Programming

Johannes Sametinger. C. Doppler Laboratory for Software Engineering Johannes Kepler University of Linz A-4040 Linz, Austria

Ingegneria del Software Corso di Laurea in Informatica per il Management. Object Oriented Principles

Software Design. Design (I) Software Design Data Design. Relationships between the Analysis Model and the Design Model

Introduction to Software Paradigms & Procedural Programming Paradigm

Chapter 8 Approaches to System Development

Design with Reuse. Building software from reusable components. Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 14 Slide 1

Philosophy of GIMnet

Overview. Software engineering and the design process for interactive systems. Standards and guidelines as design rules

A Case Study of the Systems Engineering Process in Healthcare Informatics Quality Improvement. Systems Engineering. Ali M. Hodroj

2. Analysis, Design and Implementation

COSC 3351 Software Design. Recap for the first quiz. Edgar Gabriel. Spring For the 1 st Quiz

SEEM4570 System Design and Implementation Lecture 10 Software Development Process

An Introduction to Software Architecture

Architecture. Reda Bendraou

Introduction to Object-Oriented Programming

RUP Design. Purpose of Analysis & Design. Analysis & Design Workflow. Define Candidate Architecture. Create Initial Architecture Sketch

Extend the value of your core business systems.

Questions? Assignment. Techniques for Gathering Requirements. Gathering and Analysing Requirements

Managing Variability in Software Architectures 1 Felix Bachmann*

Component Based Software Engineering: A Broad Based Model is Needed

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

Patterns in. Lecture 2 GoF Design Patterns Creational. Sharif University of Technology. Department of Computer Engineering

2. Analysis, Design and Implementation

Managing a Fibre Channel Storage Area Network

Algorithms, Flowcharts & Program Design. ComPro

Decomposition into Parts. Software Engineering, Lecture 4. Data and Function Cohesion. Allocation of Functions and Data. Component Interfaces

Software Design Document (SDD) Template

New Generation of Software Development

Reusable Knowledge-based Components for Building Software. Applications: A Knowledge Modelling Approach

Service-Oriented Architectures

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

A Model for Component Based E-governance Software Systems

Software development life cycle. Software Engineering - II ITNP92 - Object Oriented Software Design. Requirements. Requirements. Dr Andrea Bracciali

Introduction to Embedded Systems. Software Update Problem

CHAPTER 2 MODELLING FOR DISTRIBUTED NETWORK SYSTEMS: THE CLIENT- SERVER MODEL

Definition of SOA. Capgemini University Technology Services School Capgemini - All rights reserved November 2006 SOA for Software Architects/ 2

And the Models Are System/Software Development Life Cycle. Why Life Cycle Approach for Software?

Object Oriented Software Design - I

Concurrency in Object-Oriented Programming Languages

Service Oriented Architecture

Service Oriented Architecture 1 COMPILED BY BJ

Components for Operating System Design

Engineering Design. Software. Theory and Practice. Carlos E. Otero. CRC Press. Taylor & Francis Croup. Taylor St Francis Croup, an Informa business

Managing Software Evolution through Reuse Contracts

A Multi-layered Domain-specific Language for Stencil Computations

Verifying Semantic of System Composition for an Aspect-Oriented Approach

Implementation Aspects of OO-Languages

Information Systems Analysis and Design CSC John Mylopoulos. Software Architectures Information Systems Analysis and Design CSC340

Definitions. Software Metrics. Why Measure Software? Example Metrics. Software Engineering. Determine quality of the current product or process

OOP? What is OOP? Why? OOP in a nutshell. Stéphane Ducasse 2.1

Instructional Design Framework CSE: Unit 1 Lesson 1

On Applying Normalized Systems Theory to the Business Architectures of Information Systems

Layered Approach to Development of OO War Game Models Using DEVS Framework

Software Engineering. Software Engineering. Component-Based. Based on Software Engineering, 7 th Edition by Ian Sommerville

SOA and BPO SOA orchestration with flow. Jason Huggins Subject Matter Expert - Uniface

Distributed Objects and Components

Chapter 11: Integrationand System Testing

F-16 Modular Mission Computer Application Software

Contents. Introduction and System Engineering 1. Introduction 2. Software Process and Methodology 16. System Engineering 53

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

Service Oriented Architecture (SOA) An Introduction

AP Computer Science AB Syllabus 1

II. TYPES OF LEVEL A.

2 (18) - SOFTWARE ARCHITECTURE Service Oriented Architecture - Sven Arne Andreasson - Computer Science and Engineering.

Progress Report Aspect Oriented Programming meets Design Patterns. Academic Programme MSc in Advanced Computer Science. Guillermo Antonio Toro Bayona

Lesson 4 Web Service Interface Definition (Part I)

ARCHITECTURAL DESIGN OF MODERN WEB APPLICATIONS

OO Design Quality Metrics

SOFTWARE DESIGN TECHNIQUES. Nagalaxmi Telkar CSCI 5828 Presentation Slides

CompuScholar, Inc. Alignment to Utah's Computer Programming II Standards

Client/Server Computing Distributed Processing, Client/Server, and Clusters

Abstraction in Computer Science & Software Engineering: A Pedagogical Perspective

Announcements. SE 1: Software Requirements Specification and Analysis. Review: Use Case Descriptions

Object-Oriented Design Guidelines

Computing Concepts with Java Essentials

System Design Approaches. System Design. Model-Driven Approaches Modern Structured Design. Model-Driven Approaches

The Service Revolution software engineering without programming languages

Lectures 2 & 3: Introduction to Modeling & UML. Getting started

Introduction to Service Oriented Architectures (SOA)

Memory management basics (1) Requirements (1) Objectives. Operating Systems Part of E1.9 - Principles of Computers and Software Engineering

Parsing Technology and its role in Legacy Modernization. A Metaware White Paper

Transcription:

Software Design Principles and Guidelines Adam Porter Sept. 16, 2008 Overview Design Principles Important design concepts Useful design principles Design Guidelines Motivation Design Rules 1

Goals of the Design Phase Decompose System into Modules i.e., identify the software architecture Modules are program units that should: be independent, have well-specified interfaces, and have high cohesion and low coupling. Determine Relations Between Modules Identify module dependencies Determine the form and protocol for inter-module communication Goals of the Design Phase (cont'd) Specify Module Interfaces Interfaces should be well-defined facilitate independent module testing improve group communication Describe Module Functionality Informally e.g., comments or documentation Formally e.g., via module interface specification languages 2

Notional Design Phases Preliminary Design External design describes the real-world model Architectural design decomposes the requirement specification into software subsystems Detailed Design Specify each subsystem Further decompose subsystems, if necessary Note: in design phases the orientation moves from customer to developer From what to how Key Design Concepts and Principles Important design concepts and design principles: Decomposition Abstraction Information Hiding Modularity Hierarchy Separating Policy and Mechanism Each concept helps to manage software system complexity and to improve software quality factors 3

Decomposition Design activity organizes a large system into smaller pieces Basic concept is very simple: 1. Select a piece of the problem (initially, all of it) 2. Determine its components using some approach e.g., functional vs data-structured vs object-oriented 3. Specify how the components interact 4. Repeat 1-3 until some termination criteria is met e.g., components can be implemented by 1 person in a few days Decomposition (cont'd) What decomposition strategy should you use? Execution steps? Data types? Programmer assignments? Do you think it makes any difference? 4

Abstraction Decomposition strategy should yield abstractions. Abstraction manages complexity by emphasizing essential characteristics and suppressing implementation details. Allows postponement of certain design decisions Representations Algorithms Architecture Communications protocols Abstraction (cont'd) Some basic abstraction mechanisms Procedural abstraction closed subroutines Data abstraction ADTs Control abstraction iterators, loops, atomic blocks, etc. 5

Information Hiding Decomposition strategy should make change easier Information hiding is one kind of abstraction. Details of design decisions that are subject to change should be hidden behind abstract interfaces Needs some extra language support Enforce communication only through well-defined interfaces. Desired outcome Each component is specified by as little information as possible. If internal details change, client should be minimally affected Information Hiding (cont'd) Information to be hidden can include: Data representations using abstract data types Algorithms sorting or searching techniques Input and Output Formats Machine dependencies, byte-ordering, character codes Policy/mechanism distinctions Separating when vs. how: access control, caching Lower-level module interfaces Ordering of low-level operations 6

Modularity Decomposition strategy should promote modularity. Module: A self-contained software component. Module prescriptions: should possess well-specified abstract interfaces. should have high cohesion and low coupling. Modularity (cont'd) Modularity facilitates software quality factors: Extensibility - well-defined, abstract interfaces Reusability - low-coupling, high-cohesion Compatibility - design ``bridging'' interfaces Portability - hide machine dependencies 7

Modularity Principles (Overview) Principles for ensuring modular designs: Language Support for Modular Units Few Interfaces Small Interfaces (Weak Coupling) Explicit Interfaces Information Hiding Modularity Principles (cont'd) Language Support for Modular Units Modules must correspond to syntactic units in the language used. Few Interfaces Every module should communicate with as few others as possible. Small Interfaces (Weak Coupling) If any two modules communicate at all, they should exchange as little information as possible. 8

Modularity Principles (cont'd) Explicit Interfaces Whenever two modules A and B communicate, this must be obvious from the text of A or B or both. Information Hiding A module s internal details should be private to the module unless it is specifically declared public. The Open/Closed Principle A satisfactory module decomposition technique should yield modules that are both open and closed: Open Module: is one still available for extension. Necessary because requirements and specifications change Closed Module: is one available for use by other modules, usually given a well-defined, stable description and packaged in a library. Necessary because otherwise changes ripple through user code 9

The Open/Closed Principle (cont'd) Modularity is not enough to support this principle Object-oriented languages use interfaces, inheritance and dynamic binding to solve this problem. Hierarchy Motivation: reduces module interactions by restricting the topology of relationships A relation defines a hierarchy if it partitions units into levels Level 0 is the set of all units that use no other units Level i is the set of all units that use at least one unit at level < i and no unit at level i. Hierarchical structure is ubiquitous in design Facilitates independent development Isolates ramifications of change Allows rapid prototyping 10

Hierarchy (cont'd) Some relations that define hierarchies: Uses Is-A Has-A The first is general to all design methods, the latter two are more particular to object-oriented design and programming. The Uses Relation X uses Y if the correct functioning of X depends on the availability of a correct implementation of Y Note, uses is not necessarily the same as invokes: Some invocations are not uses: one-way messages Some uses don't involve invocation: external data stores 11

Uses Relation (cont'd) Allow X to use Y when: X is simpler because it uses Y Standard C library routines Y is not substantially more complex because it is not allowed to use X hierarchies should be semantically meaningful there is a useful subset containing Y and not X allows sharing and reuse of Y there is no conceivably useful subset containing X but not Y Y is necessary for X to function The Uses Relation, (cont'd) A uses relation does not necessarily yield a hierarchy (cycles) How should cycles be handled? Group X and Y as a single entity in the uses relation. A hierarchy in the uses relation is essential for designing non-trivial reusable software systems. 12

The Is-A and Has-A Relations Associated with object-oriented design and programming languages that possess inheritance and classes. Is-A or Descendant relationship class X possesses Is-A relationship with class Y if instances of class X are specializations of class Y. Has-A or Containment relationship class X possesses a Has-A relationship with class Y if instances of class X contain one or more instance(s) of class Y. Separating Policy and Mechanism Separate what/when from how. Multiple policies can be implemented by shared mechanisms. Authentication and hash-based lookup Same policy can be implemented by multiple mechanisms. FIFO sequencing can be implemented using a queue based on an array, or a linked list, or... 13

A General Design Process Given a requirements specification, design involves an iterative decision making process: List the difficult decisions and decisions likely to change Design a module specification to hide each such decision Make decisions that apply to whole program family first Modularize most likely changes first Then modularize remaining difficult decisions and decisions likely to change Design the uses hierarchy as you do this (include reuse decisions) A General Design Process (cont'd) General steps (cont'd) Treat each higher-level module as a specification and apply above process to each Continue refining until all design decisions are: hidden in a module contain easily comprehensible components provide individual, independent, low-level implementation assignments 14

Design Rules of Thumb What comes before how Define the service to be performed at every level of abstraction before deciding which structures should be used to realize the services. Separate orthogonal concerns Do not connect what is independent. Design Rules of Thumb (cont'd) Design external functionality before internal functionality. First consider the solution as a black-box and decide how it should interact with its environment. Then decide how the black-box can be internally organized. Likely it consists of smaller black-boxes that can be refined in a similar fashion. Keep it simple. Fancy designs tend to be buggier than simple ones; they are harder to implement, harder to verify, and often less efficient in practice. Problems that appear complex are often just simple problems huddled together. Our job as designers is to identify the simpler problems, separate them, and then solve them individually. 15

Design Rules of Thumb (cont'd) Design for extensibility A good design is ``open-ended,'' i.e., easily extendible. A good design often solves a class of problems rather than a single instance. Do not introduce what is immaterial. Do not restrict what is irrelevant. Use rapid prototyping when applicable Before implementing a design, build a high-level prototype and verify that the design criteria are met. Design Rules of Thumb (cont'd) Details should depend upon abstractions. Abstractions should not depend upon details Where possible, use proven patterns to solve design problems When crossing between two different paradigms, build an interface layer that separates the two Don't pollute one side with the paradigm of the other 16

Design Rules of Thumb (cont'd) Software entities (classes, modules, etc) should be open for extension, but closed for modification The Open/Closed principle -- Bertrand Meyer Subclasses must usable through the superclass interface without the need for the user to know the difference The Liskov Substitution Principle Design Rules of Thumb (cont'd) Make it work correctly, then make it work fast Implement the design, measure its performance, and only then, if necessary, optimize it. Maintain consistency between representations check that the final optimized implementation is equivalent to the highlevel design that was verified. 17