Systems Analysis and Design Allen Dennis and Barbara Haley ...

Systems Analysis and Design Allen Dennis and Barbara Haley ...

Class and Method Design Chapter 14 Slide 1 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Key Concepts Low-level or detailed design is critical despite libraries and components

Pre-existing classes need to be understood and organized Some, if not all code, is generally still needed to instantiate new classes Slide 2 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. REVISITING THE BASIC CHARACTERISTICS OF

OBJECT-ORIENTATION Slide 3 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Elements Classes Objects Attributes States

Methods Messages Slide 4 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Encapsulation Hiding the content of the object from outside view Communication only through objects methods

Key to reusability Slide 5 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Polymorphism Same message triggers different methods in different objects Dynamic binding means specific method is selected at run time

Implementation of dynamic binding is language specific Need to be very careful about run time errors Need to ensure semantic consistency Slide 6 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Inheritance Single inheritance -- one parent

class Multiple inheritance -- multiple parent classes Redefinition and inheritance conflict Most inheritance conflicts are due to poor classification Slide 7 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Rumbaughs Rules

Query operations should not be redefined Methods that redefine inherited ones should only restrict the semantics of the inherited ones The underlying semantics of the inherited method should never be changed The signature (argument list) of the inherited method should never be changed Slide 8 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved.

Additional Inheritance Conflicts Two inherited attributes or methods have same name and semantics Two inherited attributes or methods have different name, but same semantics Two inherited attributes or methods have same name and different semantics Slide 9 PowerPoint Presentation for Dennis, Wixom & Tegarden

Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Your Turn A major university graduates about 10,000 students a year and the development office wants to build a web-based system to solicit and track donations. In such a system, name 3 examples of classes that might have one subclass; name 1 example of a subclass that might have 2 superclasses

Slide 10 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. DESIGN CRITERIA Slide 11 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design

Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Coupling Interdependency among modules Interaction coupling through message passing Slide 12 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved.

Law of Demeter Messages should be sent only by an object to itself to an object contained in an attribute of itself or a superclass to an object that is passed as a parameter to the method to an object that is created by the method to an object that is stored in a global variable Slide 13 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design

Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Types of Interactive Coupling Level Type Good No Direct Coupling Data Stamp Control Common or Global

Content or Pathological Bad Slide 14 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Cohesion Single-mindedness of a module Method cohesion Class cohesion

Generalization/specialization cohesion Slide 15 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Types of Method Cohesion Level Type

Good Functional Sequential Communicational Procedural Temporal or Classical Logical Coincidental Bad Slide 16

PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Types of Class Cohesion Level Type Good Ideal Mixed-role

Mixed-domain Worse Slide 17 Mixed-instance PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Connascence Creating the need to change another module as a result of

changing one Minimize overall connascence Minimize across encapsulation boundaries Maximize within encapsulation boundary Slide 18 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Types of Connascence

Type Name Type or Class Convention Algorithm Position Slide 19 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. OBJECT DESIGN ACTIVITIES

Slide 20 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Additional Specification First review the current set of models Sufficient but only necessary classes to solve problem No missing attributes or methods

No extraneous attributes or methods Examine visibility Slide 21 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Signatures for each method Name of the method Parameters or arguments to

pass Type of value the method will return to the calling method Slide 22 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Define constraints Pre-conditions Post conditions

Invariants How to handle violations (exceptions in C++ and Java)? Slide 23 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Identify Opportunities for Reuse Patterns

Framework Class libraries Components Slide 24 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Restructure the Design Factoring Map design to current language

Normalization Assure all inheritance relationships support only generalization/specialization semantics Slide 25 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Optimizing the Design Review access paths

Review attributes of each class Review direct and indirect fan-out Consider execution order of statements in often-used methods Avoid recomputation by creating derived attributes and triggers Slide 26 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Constraints and Contracts

A set of constraints and guarantees Written in natural language, structured English, pseudocode, or formal language Slide 27 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Invariants on a Class

Diagram Slide 28 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Simple Contract Format Method Name: Class Name:

ID: Clients (Consumers): Associated Use Cases: Description of Responsibilities: Arguments Received: Type of Value Returned: Pre-Conditions: Post-Conditions: Slide 29 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design

Copyright 2001 John Wiley & Sons, Inc. All rights reserved. METHOD SPECIFICATION Slide 30 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Syntax No formal syntax specification General information

Events Message Passing Algorithm Specification Slide 31 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Structured English Slide 32

PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Pseudocode Example (Get CD-info module) Accept (CD_title) {Required} Accept (CD_artist) {Required} Accept (CD_category) {Required} Accept (CD_length) Return

Slide 33 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and

Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Summary

Translating the basic elements of OO analysis into design requires attention to prevent difficulties and conflicts in execution. Coupling, cohesion, and connascence are proposed for criteria for evaluating design. The designer will look for opportunities to optimize the design, will create constraints and contracts, and will specify methods. Slide 38 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design

Copyright 2001 John Wiley & Sons, Inc. All rights reserved. Expanding the Domain The C and C++ users group is a source of unusually rich thoughts regarding OO development. Check them out at: http://www.accu.org/ http://www.accu-usa.org/ Slide 39 PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and

Design Copyright 2001 John Wiley & Sons, Inc. All rights reserved.

Recently Viewed Presentations

  • Energy Flow through Ecological Systems - San Jose State ...

    Energy Flow through Ecological Systems - San Jose State ...

    Cycling of Matter in Ecological Systems The balance of life… Or Biogeochemical Cycles Each element has its own story All nutrients flow from nonliving (abiotic) to living (biotic) and back to nonliving (abiotic) in what is called a biogeochemical cycle.
  • Vocabulary Unit #7 - Washington Township Public School District

    Vocabulary Unit #7 - Washington Township Public School District

    adj.—open to attack; capable of being wounded or damaged, unprotected. Synonym: defenseless, unguarded. Those brave enough to have opposed the dictator's rise now found themselves in a . vulnerable. position. vulnerable
  • MATERIE - Libero.it

    MATERIE - Libero.it

    La sua famiglia è composta dal padre Otto Frank, dalla madre Edith Hollander e dalla sorella maggiore Margot. La vicenda inizia il 12 giugno 1942, quando ad Anne per il suo compleanno le viene regalato un diario. Lo chiamerà Kitty...
  • storm.cis.fordham.edu

    storm.cis.fordham.edu

    We call the fact that any integer is either even or odd the parity property. Example 5 - Consecutive Integers Have Opposite Parity. Prove that given any two consecutive integers, one is even and the other is odd. Solution:Two integers...
  • Hadronic Moments in Semileptonic B decays Status Report

    Hadronic Moments in Semileptonic B decays Status Report

    Backup Slides Moments Correlations Vcb: exclusive determination Measure absolute scale of B D*l D** states also important for |Vcb| exclusive determination end-point in q2 for B D*l decays systematic uncertainty from B D**l background Channels with neutral B B0 D**+...
  • Gli acquisti librari - Biblioteca civica di Cologno Monzese

    Gli acquisti librari - Biblioteca civica di Cologno Monzese

    Nel 2000 è iniziata la catalogazione in Sebina dei video (film, film in lingua originale), per cui la situazione dovrebbe sanarsi per il prossimo anno. Brother, WHO art thou? Chi sono gli utenti della Fonoteca? Fratello, dove sei? Joel e...
  • The Industrial Revolution - Loudoun County Public Schools

    The Industrial Revolution - Loudoun County Public Schools

    Palestine was partitioned and a new nation-state was created Israel Israel is the nation-state for this religious/ethnic group Jews (Judaism) Today, Israel is home to the Jewish people. In what part of the world did they used to live? Europe...
  • Color Quality Scale

    Color Quality Scale

    Chromatic adaptation is the ability of the human visual system to discount the color of the illumination and to approximately preserve the appearance of an object. Marcel van der Steen, www.OliNo.org (e.g. white sheet of paper under different illuminants) CQS...