Copyright W. Howden1 Lecture 7: Functional and OO Design Descriptions.

Slides:



Advertisements
Similar presentations
Week 2 The Object-Oriented Approach to Requirements
Advertisements

Testing Object Oriented Programs CSE 111 4/28/20151.
Copyright W. Howden1 Singleton, Wrapper, and Facade Patterns CSE 111.
Object-Oriented Analysis and Design
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 5: Restaurant.
Lecture 5a: Sequence Interaction Diagrams CSE 111 Copyright W. Howden1.
Copyright W. Howden1 Lecture 3: Elaboration and System Architecture.
Component-Level Design
Copyright W. Howden1 Lecture 6: Design Evaluation and Intro to OO Design Patterns.
Copyright W. Howden1 Lecture 8: O/O Programming. Copyright W. Howden2 Topics OO Programming Languages Developing programs from Designs –Class and method.
Copyright W. Howden1 Lecture 11: UML Terminology and Additional Models and Notation.
Copyright W. Howden1 Lecture 13: Programming by Contract.
1 Lecture 3: Elaboration and System Architecture.
Copyright W. Howden1 Lecture 4: Sequence Interaction Diagrams.
Copyright W. Howden1 Lecture 19: Intro to O/O Components.
Copyright W. Howden1 Lecture 5: Collaboration Diagrams.
Collaboration Diagrams. Example Building Collaboration Diagrams.
Lecture 5b: Basic Design Patterns CSE 111. Basic Design Patterns We know our subsystem interface classes and (some of) their methods We need to create.
System Architecture Lecture 3 CSE 111 Spring /22/20151Copyright William E. Howden.
1 Lecture 2: Elaboration Tasks and Domain Modeling.
Copyright W. Howden1 Lecture 15: Generalization, Polymorphism and States.
Copyright W. Howden1 Lecture 6: Collaboration Diagrams.
Copyright W. Howden1 Lecture 2: Elaboration Tasks and Domain Modeling.
Copyright W. Howden1 Lecture 4: Elaboration Tasks and Domain Modeling.
Lecture a: Additional UML Models: Package, Activity, Deployment Lecture b: Generalization, Aggregation and Additional Domain Model Notation Copyright W.
Objectives Explain the purpose and objectives of object- oriented design Develop design class diagrams Develop interaction diagrams based on the principles.
NJIT Designing for Visibility Chapter 19 Applying UML and Patterns Craig Larman.
Lecture 8: Structured Design and Object Oriented Design CSE 111 7/12/20151Copyright William. E. Howden.
Copyright W. Howden1 State Models and the State Pattern.
Lecture 7: UML Class Diagrams CSE 111 7/15/20151Copyright W. Howden.
SE-565 Software System Requirements More UML Diagrams.
Object-Oriented Analysis and Design
Chapter 7: The Object-Oriented Approach to Requirements
Object-Oriented Design. From Analysis to Design Analysis Artifacts –Essential use cases What are the problem domain processes? –Conceptual Model What.
Object Oriented Software Development
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
The Design Discipline.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Systems Analysis and Design in a Changing World, 3rd Edition
1 ITEC 2010 Chapter 9 – Design The Structure Chart Structure chart –A hierarchical diagram showing the relationships between the modules of a.
Java™ How to Program, 10/e © Copyright by Pearson Education, Inc. All Rights Reserved.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
Design Model Lecture p6 T120B pavasario sem.
SOFTWARE DESIGN. INTRODUCTION There are 3 distinct types of activities in design 1.External design 2.Architectural design 3.Detailed design Architectural.
CSC 131 Fall 2006 Lecture # 6 Object-Oriented Concepts.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 26 - Java Object-Based Programming Outline 26.1Introduction.
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
Java™ How to Program, 9/e © Copyright by Pearson Education, Inc. All Rights Reserved.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
Introduction to Object-Oriented Programming Lesson 2.
OO Methodology Elaboration Phase Iteration 1- Part 3.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
Fusion Design Overview Object Interaction Graph Visibility Graph Class Descriptions Inheritance Graphs Fusion: Design The overall goal of Design is to.
Design Model: Determining Visibility CH-18. Objectives Identify four kinds of visibility. Design to establish visibility. Illustrate kinds of visibility.
Chapter 5 Introduction to Defining Classes Fundamentals of Java.
Lecture 4: Elaboration Tasks and Domain Modeling
GRASP: Visibility and Design
Chapter 3: Using Methods, Classes, and Objects
Chapter 3 Introduction to Classes, Objects Methods and Strings
Requirements To Design In This Iteration
Chapter 6 Methods: A Deeper Look
Lecture 4: Sequence Interaction Diagrams
Analysis models and design models
Sylnovie Merchant, Ph.D. MIS 161 Spring 2005
Java Programming Language
Object Oriented System Design Class Diagrams
CS 1054: Lecture 2, Chapter 1 Objects and Classes.
Presentation transcript:

Copyright W. Howden1 Lecture 7: Functional and OO Design Descriptions

Copyright W. Howden2 Executable Units Functional –Procedures –Functions –Subroutines Modules –Collections of procedures –Interface procedures Object Oriented –Classes –Interfaces –Class methods Components –Collections of classes –Interface classes

Copyright W. Howden3 Functional Design Module connection/relationship models Design development –Top down design –Program refinement Module/Procedure call/use diagrams Algorithm design descriptions –Pseudo-Code –Nassi-Schneiderman diagrams –Decision Tables

Copyright W. Howden4 Object Oriented Design Component connection/relationship models Design development –interaction sequence, collaboration diagrams –visibility analysis Design Diagrams – Class Structure Method design descriptions –algorithm design descriptions

Copyright W. Howden5 Functional Design Diagrams – Function Interactions Tree structure Nodes are procedures or modules Arcs are calls or uses Arc notation: shows flow of data from one node to another: data couples Computational and control flow couples

Copyright W. Howden6

7 DS Top Down Design DS process Dater or Admin process Dater process GetADate or SetMember Data process Filemanager process Admin process Add or Delete process FileManager process

Copyright W. Howden8 DS PseudoCode and Program Refinement Member Data getADate(DaterPreferences daterPrefs) { Record record; Boolean match = false; record = filemanager(“getFirst”); see if record matches daterPrefs and set match while ((record =/ null) and (match == false)) { record = filemanager(“getNext); see if record matches daterPrefs and set match } if (match = = false) return null else return record; }

Copyright W. Howden9 Data Visibility For Functional Programs Data item: a function f uses or accesses a data item. How do we enable it to access and manipulate this data. –Local variable: declare one and assign data to it –Parameter: accessed passed data using formal parameter, or assign it to a local variable –Assign and reference data via a global variable

Copyright W. Howden10 Type Visibility of Functional Programs Variable declarations involve a type Type definition visibility –Global generic types –Global struct definitions (C ) –Local struct definitions –Includes files

Copyright W. Howden11 Object Oriented Design Diagrams – Class Models Graph structure Nodes correspond to classes Arcs are relationships between classes Visibility analysis in class diagrams –Solid arc from A to B indicates A has a class variable whose values are instances of B –Dotted arcs indicate other kinds of visibility implementations

Copyright W. Howden12 Diagram Details Nodes/Classes –Attributes: associated simple variables –Names and signatures of methods –Similar to Domain model classes, + methods Arcs – type of relationship, roles, multiplicity Separate details: for readability

Copyright W. Howden13

Copyright W. Howden14 Object Visibility for Object Oriented Designs An object X of class A has the ability to see or reference an object Y of class B E.g. in a collaboration diagram, X sends a message to Y Will require some way of achieving this visibility in the design Design Class Diagram can be used to document visibility implementation decisions

Copyright W. Howden15 Ways to Achieve Object Visibility Attribute Parameter Local Variable Global

Copyright W. Howden16 Attribute Visibility Class A can be defined with an attribute variable y whose values are of class B, which can be assigned the value Y E.g. :GUIFrame object in DS sends a getUserType() message to object dL:DomainLogic

Copyright W. Howden17

Copyright W. Howden18 Attribute Visibility Solution Class GUIFrame, the class for the object :GUIFrame, will have an attribute/class variable dL of type DomainLogic whose value is the object dL. Permanent association needed. Attribute visibility is a good solution.

Copyright W. Howden19 Parameter Visibility Y is referenced inside a method m() for X’s class A. Y can be passed as a parameter y of m() which can be referenced in m() Eg. GUIFrame is going to set dL attribute variable to the dL Object, i.e. establish the attribute visibility in the earlier example.

Copyright W. Howden20

Copyright W. Howden21 Parameter Visibility Solution Parameter dL:DomainLogic will be passed as a parameter in the constructor for GUIFrame. Temporary parameter visibility is then changed to a more permanent attribute visibility

Copyright W. Howden22 Local Variable Visibility A method m() in the class A for X can be defined with a local variable y of class B, that can be assigned to Y. E.g. In the GUI example, when a user selects the option of getting a date, the system will create and display an SelectDataPrefsDialog.

Copyright W. Howden23

Copyright W. Howden24 Local Variable Visibility Solution Solution: the method in DaterOptionsSelectionDialog that is invoked when the getDate() button is pressed will have a local variable of type SelectDaterPrefsDialog that can be assigned to the object :SelectDaterPrefsDialog that is created at this point.

Copyright W. Howden25 Global Visibility The object Y is made global to all classes so that all can reference it. E.g. The Message Dialog is used over and over in DS. Global visibility solution. Create a top level class that is global to all that use it. Assume it has a static object x whose value is dialog instance that can be re-used with different messages

Copyright W. Howden26 GUI Example Simple diagram with relationships Sample detailed class descriptions given separately –Each has setVisible(), show(), a constructor and a method for responding to a button event that will be called by the OS

Copyright W. Howden27

Copyright W. Howden28

Copyright W. Howden29 O/O Programming and Class Visibility Declaration of an object of some class –E.g. Attribute/class variable, local variable (method), parameter (method), global –How is the class definition known in that context? –Determines structuring of class definitions Java: Inner class definition, file visibility, package visibility, import visibility

Copyright W. Howden30 Class Visibility – Inner Classes Class A has an attribute variable y of class B Include the definition for class B inside class A E.g. in DS, all of the GUI class definitions are inner classes in GUI, which makes it possible to define instances of them

Copyright W. Howden31 File Visibility A class in a file can access other class definitions in that file E.g. DS The class definition for the message class file is included in the GUI class file. GUI is the public object in this file (Java)

Copyright W. Howden32 Package Visibility The classes in one file in a package can see the public and non-private classes in other files. Private classes in a file are not visible outside the file.

Copyright W. Howden33 Import Visibility One file can declare itself to be part of a named package A file can import files in specified packages E.g. In DS GUI has parameter visibility to a Domain Logic object that is passed to its constructor. GUI has visibility to the DomainLogic class via an import statement

Copyright W. Howden34 Domain Logic Examples Object visibility problem –An object X of class A has the ability to see or reference an object Y of class B –E.g. in a collaboration diagram, X sends a message to Y –Will require some way of achieving this visibility in the design

Copyright W. Howden35 Object Visibility Solutions Attribute Parameter Local Variable Global

Copyright W. Howden36 Attribute Visibility Class A can be defined with an attribute variable y whose values are of class B, which can be assigned the value Y E.g. dL:DomainLogic object in DS sends a getMemberData() message to object :DataBase

Copyright W. Howden37

Copyright W. Howden38 Attribute Visibility Solution Class DomainLogic, the class for the object dL:DomainLogic, will have an attribute/class variable dB of type DataBase whose value is the object dB. Permanent association needed. Attribute visibility is a good solution.

Copyright W. Howden39 Parameter Visibility Y is referenced inside a method m() for X’s class A. Y can be passed as a parameter y of M() which can be referenced in m() E.g. In the DS, DomainLogic is going to set dB attribute variable to the dB Object, i.e. establish the attribute visibility in the earlier example

Copyright W. Howden40

Copyright W. Howden41 Parameter Visibility Solution Parameter dB:DataBase will be passed as a parameter in the constructor for DomainLogic. Temporary parameter visibility is then changed to a more permanent attribute visibility

Copyright W. Howden42 Local Variable Visibility A method m() in the class A for X can be defined with a local variable y of class B, that can be assigned to Y. E.g. DS class DomainLogic has a method setMemberData that is called from GUI. It calls getMemberData(userName) in the data base to get back a member record which it then processes.

Copyright W. Howden43

Copyright W. Howden44 Local Variable Visibility Solution Solution: the setMemberData(), method will have a local variable mD which it can assign to the MemberData record returned from getMemberData(). This will enable it to maintain temporary visibility during the life of setMemberData.

Copyright W. Howden45 Domain Logic Class Diagram Shows association relationships (attributes and other kinds of dependencies) Derived from above and other Collaboration Models Class details (attributes and methods) omitted Associations show class visibility also

Copyright W. Howden46