What is design? Provides structure to any artifact Decomposes system into parts, assigns responsibilities, ensures that parts fit together to achieve a.

Slides:



Advertisements
Similar presentations
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Advertisements

Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Object-Oriented Analysis and Design
Object-Oriented Design & Programming Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
Component-Level Design
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Object Oriented System Development with VB .NET
Ch4: Software Architecture and Design. 1 What is a design?
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
1 CMSC 132: Object-Oriented Programming II Software Development IV Department of Computer Science University of Maryland, College Park.
Design and Software Architecture
Ch4: Software Architecture and Design. 1 Modules: Interface vs. Implementation (contd..)  Interface design considerations:
Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Abstract Data Types and Encapsulation Concepts
Object-oriented design CS 345 September 20,2002. Unavoidable Complexity Many software systems are very complex: –Many developers –Ongoing lifespan –Large.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
03 - ParnasCSC4071 A Sketchy Evolution of Software Design 1960s –Structured Programming (“Goto Considered Harmful”, E.W.Dijkstra) Emerged from considerations.
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
Introduction To System Analysis and design
Comparison of OO Programming Languages © Jason Voegele, 2003.
Introduction to Object-oriented programming and software development Lecture 1.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
1 CS 456 Software Engineering. 2 Contents 3 Chapter 1: Introduction.
Ceg860 (Prasad)L6MR1 Modularity Extendibility Reusability.
Copyright 2001 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix A Object-Oriented.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Unified Modeling Language, Version 2.0
Ch. 41 Design and Software Architecture. Ch. 42 Outline What is design How can a system be decomposed into modules What is a module’s interface What are.
Ch. 41 Design and Software Architecture. Ch. 42 Outline What is design How can a system be decomposed into modules What is a module’s interface What are.
Generative Programming. Automated Assembly Lines.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 13 (Online): Object-Oriented Data Modeling Modern Database Management 10 th Edition.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
Computing and SE II Chapter 9: Design Methods and Design Models Er-Yu Ding Software Institute, NJU.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
What is Object-Oriented?  Organization of software as a collection of discreet objects that incorporate both data structure and behavior.
Dale Roberts Object Oriented Programming using Java - Introduction Dale Roberts, Lecturer Computer Science, IUPUI Department.
1 CMPT 275 High Level Design Phase Modularization.
SOFTWARE DESIGN. INTRODUCTION There are 3 distinct types of activities in design 1.External design 2.Architectural design 3.Detailed design Architectural.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
OBJECT ORIENTED AND FUNCTION ORIENTED DESIGN 1 Chapter 6.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Object-Oriented Programming Chapter Chapter
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
1 Software Design Lecture What’s Design It’s a representation of something that is to be built. i.e. design  implementation.
Object-Oriented Programming © 2013 Goodrich, Tamassia, Goldwasser1Object-Oriented Programming.
1 Unified Modeling Language, Version 2.0 Chapter 2.
Review of Parnas’ Criteria for Decomposing Systems into Modules Zheng Wang, Yuan Zhang Michigan State University 04/19/2002.
1 CS Programming Languages Class 22 November 14, 2000.
Lecture 2: Review of Object Orientation. © Lethbridge/La ganière 2005 Chapter 2: Review of Object Orientation What is Object Orientation? Procedural.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Appendix A Object-Oriented Analysis and Design A.1.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
Basic Characteristics of Object-Oriented Systems
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
Roberta Roth, Alan Dennis, and Barbara Haley Wixom
The Movement To Objects
Object-Oriented Analysis and Design
Systems Analysis and Design With UML 2
Software Design.
Systems Analysis and Design With UML 2
About the Presentations
Chapter 20 Object-Oriented Analysis and Design
Copyright 2007 Oxford Consulting, Ltd
Chapter 11 Abstraction - The concept of abstraction is fundamental in
Presentation transcript:

What is design? Provides structure to any artifact Decomposes system into parts, assigns responsibilities, ensures that parts fit together to achieve a global goal Design refers to both an activity and the result of the activity

Two meanings of "design“ activity in our context Activity that acts as a bridge between requirements and the implementation of the software Activity that gives a structure to the artifact e.g., a requirements specification document must be designed must be given a structure that makes it easy to understand and evolve

The sw design activity Software architecture is produced prior to a software design Defined as system decomposition into modules Produces a Software Design Document describes system decomposition into modules

Two important goals Design for change (Parnas) designers tend to concentrate on current needs special effort needed to anticipate likely changes Product families (Parnas) think of the current system under design as a member of a program family

Sample likely changes? (1) Algorithms e.g., replace inefficient sorting algorithm with a more efficient one Change of data representation e.g., from binary tree to a threaded tree (see example)  17% of maintenance costs attributed to data representation changes (Lientz and Swanson, 1980)

Example

Sample likely changes? (2) Change of underlying abstract machine new release of operating system new optimizing compiler new version of DBMS … Change of peripheral devices Change of "social" environment new tax regime EURO vs national currency in EU Change due to development process (transform prototype into product)

Product families Different versions of the same system e.g. a family of mobile phones members of the family may differ in network standards, end-user interaction languages, … e.g. a facility reservation system for hotels: reserve rooms, restaurant, conference space, …, equipment (video beamers, overhead projectors, …) for a university many functionalities are similar, some are different (e.g., facilities may be free of charge or not)

Design goal for family Design the whole family as one system, not each individual member of the family separately

Sequential completion: the wrong way Design first member of product family Modify existing software to get next member products

Sequential completion: a graphical view Requirements Version 1 Version 2 5 Requirements Version 3 4 Requirements Version 2 5 Version 1 4 intermediate design final product

How to do better Anticipate definition of all family members Identify what is common to all family members, delay decisions that differentiate among different members We will learn how to manage change in design

Module A well-defined component of a software system A part of a system that provides a set of services to other modules Services are computational elements that other modules may use First suggested in D.Parnas “On the criteria to be used in decomposing systems into modules” in Comm. of the ACM, v.15 pp , 1972

Questions How to define the structure of a modular system? What are the desirable properties of that structure?

Modules and relations Let S be a set of modules S = {M 1, M 2,..., M n } A binary relation r on S is a subset of S x S If M i and M j are in S,  r can be written as M i r M j

Relations Transitive closure r + of r M i r + M j iff M i r M j or  M k in S s.t. M i r M k and M k r + M j (We assume our relations to be irreflexive) r is a hierarchy iff there are no two elements M i, M j s.t. M i r + M j  M j r + M i

Relations Relations can be represented as graphs A hierarchy is a DAG (directed acyclic graph) a graph a DAG

The USES relation A uses B A requires the correct operation of B A can access the services exported by B through its interface it is “statically” defined A depends on B to provide its services example: A calls a routine exported by B A is a client of B; B is a server

Desirable property USES should be a hierarchy Hierarchy makes software easier to understand we can proceed from leaf nodes (who do not use others) upwards They make software easier to build They make software easier to test

Hierarchy Organizes the modular structure through levels of abstraction Each level defines an abstract (virtual) machine for the next level level can be defined precisely M i has level 0 if no M j exists s.t. M i r M j let k be the maximum level of all nodes M j s.t. M i r M j. Then M i has level k+1

IS_COMPONENT_OF Used to describe a higher level module as constituted by a number of lower level modules A IS_COMPONENT_OF B B consists of several modules, of which one is A B COMPRISES A M S,i ={M k |M k  S  M k IS_COMPONENT_OF M i } we say that M S,i IMPLEMENTS M i

A graphical view M 1 M M M M MM M M 3 M M MM M M 2 M 3 M 4 M 1 (IS_COMPONENT_OF) (COMPRISES) They are a hierarchy

Product families Careful recording of (hierarchical) USES relation and IS_COMPONENT_OF supports design of program families

Interface vs. implementation (1) To understand the nature of USES, we need to know what a used module exports through its interface The client imports the resources that are exported by its servers Modules implement the exported resources Implementation is hidden to clients

Interface vs. implementation (2) Clear distinction between interface and implementation is a key design principle Supports separation of concerns clients care about resources exported from servers servers care about implementation Interface acts as a contract between a module and its clients

Information hiding Basis for design (i.e. module decomposition) Implementation secrets are hidden to clients They can be changed freely if the change does not affect the interface Golden design principle INFORMATION HIDING Try to encapsulate changeable design decisions as implementation secrets within module implementations

Interface design Interface should not reveal what we expect may change later It should not reveal unnecessary details Interface acts as a firewall preventing access to hidden parts

Prototyping Once an interface is defined, implementation can be done first quickly but inefficiently then progressively turned into the final version Initial version acts as a prototype that evolves into the final product

Design notations Notations allow designs to be described precisely They can be textual or graphic We illustrate two sample notations TDN (Textual Design Notation) GDN (Graphical Design Notation) We discuss the notations provided by UML

TDN & GDN Illustrate how a notation may help in documenting design Illustrate what a generic notation may look like Are representative of many proposed notations TDN inherits from modern languages, like Java, Ada, …

An example

Comments in TDN May be used to specify the protocol to be followed by the clients so that exported services are correctly provided e.g., a certain operation which does the initialization of the module should be called before any other operation e.g., an insert operation cannot be called if the table is full

Example (cont.)

Benefits Notation helps describe a design precisely Design can be assessed for consistency having defined module X, modules R and T must be defined eventually if not  incompleteness R, T replace X  either one or both must use Y, Z

GDN description of module X

X's decomposition

Categories of modules Functional modules traditional form of modularization provide a procedural abstraction encapsulate an algorithm e.g. sorting module, fast Fourier transform module, …

Categories of modules (cont.) Libraries a group of related procedural abstractions e.g., mathematical libraries implemented by routines of programming languages Common pools of data data shared by different modules e.g., configuration constants the COMMON FORTRAN construct

Categories of modules (cont.) Abstract objects Objects manipulated via interface functions Data structure hidden to clients Abstract data types Many instances of abstract objects may be generated

ADTs Correspond to Java and C++ classes Concept may also be implemented by Ada private types and Modula-2 opaque types May add notational details to specify if certain built- in operations are available by default on instance objects of the ADT

Specific techniques for design for change Use of configuration constants factoring constant values into symbolic constants is a common implementation practice e.g., #define in C # define MaxSpeed 5600;

Specific techniques for design for change (cont.) Conditional compilation...source fragment common to all versions... # ifdef hardware-1...source fragment for hardware 1... # endif #ifdef hardware-2...source fragment for hardware 2... # endif Software generation –e.g., compiler compilers (yacc, interface prototyping tools)

Stepwise refinement A systematic, iterative program design technique that unfortunately may lead to software that is hard to evolve At each step, problem P decomposed into sequence of subproblems: P1; P2; …Pn a selection: if (cond) then P1 else P2 an iteration: while (cond) do_something

An assessment of stepwise refinement (1) Stepwise refinement is a programming technique, not a modularization technique When used to decompose system into modules, it tends to analyze problems in isolation, not recognizing commonalities It does not stress information hiding

An assessment of stepwise refinement (2) No attention is paid to data (it decomposes functionalities) Assumes that a top function exists but which one is it in the case of an operating system? or a word processor? Enforces premature commitment to control flow structures among modules

Top-down vs. bottom-up Information hiding proceeds bottom-up Iterated application of IS_COMPOSED_OF proceeds top-down stepwise refinement is intrinsically top-down Which one is best? in practice, people proceed in both directions yo-yo design organizing documentation as a top-down flow may be useful for reading purposes, even if the process followed was not top-down

Handling anomalies Defensive design A module is anomalous if it fails to provide the service as expected and as specified in its interface An exception MUST be raised when anomalous state is recognized

How can failures arise? Module M should fail and raise an exception if one of its clients does not satisfy the required protocol for invoking one of M ’ s services M does not satisfy the required protocol when using one of its servers, and the server fails hardware generated exception (e.g., division by zero)

What a module can do before failing Before failing, modules may try to recover from the anomaly by executing some exception handler (EH) EH is a local piece of code that may try to recover from anomaly (if successful, module does not fail) or may simply do some cleanup of the module ’ s state and then let the module fail, signaling an exception to its client

A further relation: inheritance ADTs may be organized in a hierarchy Class B may specialize class A B inherits from A conversely, A generalizes B A is a superclass of B B is a subclass of A

Inheritance A way of building software incrementally A class defines a parameterized object template including the constructor function Polymorphism Dynamic binding the method invoked through a reference depends on the type of the object associated with the reference at runtime

Object-Oriented Approach Must be understood to apply class- based elements of the analysis model Key principles Inheritance Encapsulation (data, functions) Polymorphism (pure form in ML) Key concepts: Classes and objects Attributes and operations Encapsulation and instantiation Inheritance relationship

Object-Oriented Languages Simula-67 – first OOPL (1967), developed at Norwegian Computing Center, Oslo, Norway by Ole-Johan Dahl and Kristen Nygaard Some others: Smalltalk, Eiffel, C++, Java Bjarne Stroustrup (“What is Object- Oriented Progamming ?”, 1988,1991): Object-oriented programming is programming using inheritance

Other approaches Subject-oriented programming A subject is a collection of classes or class fragments whose hierarchy models its domain in its own, subjective way. Aspect-oriented programming Separation of concerns. Agent-oriented programming Software system developed as a collection of agents. Feature-oriented programming study of feature modularity, where features are raised to first-class entities in design. Features are implemented by cross-cuts that are modifications or extensions to multiple classes. Intentional programming "Intents", ultimately, are another high-level programming language with tools to automate the intents writing and translation to lower-level languages.

How can inheritance be represented? We start introducing the UML notation UML (Unified Modeling Language) is a widely adopted standard notation for representing OO designs We introduce the UML class diagram classes are described by boxes

UML representation of inheritance

UML associations Associations are relations that the implementation is required to support Can have multiplicity constraints

Aggregation Defines a PART_OF relation Differs from IS_COMPOSED_OF Here TRANGLE has its own methods It implicitly uses POINT to define its data attributes

More on UML Representation of IS_COMPONENT_OF via the package notation