CMPE 135: Object-Oriented Analysis and Design September 6 Class Meeting Department of Computer Engineering San Jose State University Fall 2018 Instructor:

Slides:



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

Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
Introduction To System Analysis and Design
© Copyright Eliyahu Brutman Programming Techniques Course.
Chapter 7: The Object-Oriented Approach to Requirements
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
CS 151: Object-Oriented Design September 3 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak
CS 160: Software Engineering September 10 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Introduction To System Analysis and Design
CS 46B: Introduction to Data Structures June 16 Class Meeting Department of Computer Science San Jose State University Summer 2015 Instructor: Ron Mak.
Systems Analysis & Design 7 th Edition Chapter 5.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
L6-S1 UML Overview 2003 SJSU -- CmpE Advanced Object-Oriented Analysis & Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
An Introduction to the Unified Modeling Language
1 System Analysis and Design Using UML INSTRUCTOR: Jesmin Akhter Lecturer, IIT, JU.
OOAD Unit – I OBJECT-ORIENTED ANALYSIS AND DESIGN With applications
CIS 112 Exam Review. Exam Content 100 questions valued at 1 point each 100 questions valued at 1 point each 100 points total 100 points total 10 each.
CS 151: Object-Oriented Design September 5 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak
Unified Modeling Language. Object Oriented Methods ► What are object-oriented (OO) methods?  OO methods provide a set of techniques for analyzing, decomposing,
ITEC324 Principle of CS III Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
CS 160 and CMPE/SE 131 Software Engineering February 25 Class Meeting Department of Computer Science Department of Computer Engineering San José State.
Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
CS 160 and CMPE/SE 131 Software Engineering March 8 Class Meeting Department of Computer Science Department of Computer Engineering San José State University.
Introduction to UML.
Appendix 3 Object-Oriented Analysis and Design
CMPE 135: Object-Oriented Analysis and Design August 31 Class Meeting
CHAPTER
Cmpe 589 Spring 2006.
UML Diagrams By Daniel Damaris Novarianto S..
CMPE 280 Web UI Design and Development August 29 Class Meeting
Roberta Roth, Alan Dennis, and Barbara Haley Wixom
Course Outcomes of Object Oriented Modeling Design (17630,C604)
Object-Oriented Analysis and Design
Object-Oriented Modeling with UML
Object-Oriented Software Engineering Using UML, Patterns, and Java,
Unified Modeling Language
Complexity Time: 2 Hours.
Introduction to Unified Modeling Language (UML)
CMPE 135: Object-Oriented Analysis and Design October 24 Class Meeting
About the Presentations
UML Diagrams Jung Woo.
Business System Development
CS 174: Server-Side Web Programming February 12 Class Meeting
Introduction to Unified Modeling Language (UML)
Week 12: Activity & Sequence Diagrams
University of Houston-Clear Lake
Introduction to Unified Modeling Language (UML)
Chapter 20 Object-Oriented Analysis and Design
CIS 375 Bruce R. Maxim UM-Dearborn
An Introduction to Software Architecture
Copyright 2007 Oxford Consulting, Ltd
Software Engineering System Modeling Chapter 5 (Part 1) Dr.Doaa Sami
CMPE 135 Object-Oriented Analysis and Design March 21 Class Meeting
Applying Use Cases (Chapters 25,26)
Chapter 5.
Chapter 22 Object-Oriented Systems Analysis and Design and UML
CIS 375 Bruce R. Maxim UM-Dearborn
Chapter 4 System Modeling.
Appendix 3 Object-Oriented Analysis and Design
Object-Oriented Analysis and Design
ITEC324 Principle of CS III
ITEC324 Principle of CS III
CMPE/SE 131 Software Engineering February 22 Class Meeting
Presentation transcript:

CMPE 135: Object-Oriented Analysis and Design September 6 Class Meeting Department of Computer Engineering San Jose State University Fall 2018 Instructor: Ron Mak www.cs.sjsu.edu/~mak

On Complexity A physician, a civil engineer, and a computer scientist were arguing about what was the oldest profession in the world. The physician remarked, “Well, in the Bible, it says that God created Eve from a rib taken out of Adam. This clearly required surgery, and so I can rightly claim that mine is the oldest profession in the world.” The civil engineer interrupted, and said, “But even earlier in the book of Genesis, it states that God created the order of the heavens and the earth from out of the chaos. This was the first and certainly the most spectacular application of civil engineering. Therefore, fair doctor, you are wrong: mine is the oldest profession in the world.” The computer scientist leaned back in her chair, smiled, and then said confidently, “Ah, but who do you think created the chaos?” Object-Oriented Analysis and Design with Applications, 3rd edition by Bobbi J. Young Ph.D., Kelli A. Houston, Jim Conallen, Michael W. Engle, Robert A. Maksimchuk, and Grady Booch Addison-Wesley Professional, 2007 ISBN 9780201895513

Decomposition One way to deal with complexity is to “divide and conquer”. Decompose a complex system into smaller and smaller parts. We only need to comprehend a few small parts rather than all the parts at once. Algorithmic vs. object-oriented decomposition

Algorithmic Decomposition Traditional top-down structured design. Each module is a step in the overall process. Show the relationships among the various functional elements of the solution. Update the content of a master file. Object-Oriented Analysis and Design with Applications, 3rd edition by Bobbi J. Young Ph.D., Kelli A. Houston, Jim Conallen, Michael W. Engle, Robert A. Maksimchuk, and Grady Booch Addison-Wesley Professional, 2007 ISBN 9780201895513

Object-Oriented Decomposition Decompose according the the key abstractions of the problem domain. View the world as a set of autonomous agents. Object-Oriented Analysis and Design with Applications, 3rd edition by Bobbi J. Young Ph.D., Kelli A. Houston, Jim Conallen, Michael W. Engle, Robert A. Maksimchuk, and Grady Booch Addison-Wesley Professional, 2007 ISBN 9780201895513

Which Decomposition is Better? Algorithmic Highlight the ordering of events. Object-oriented Emphasize the agents that either cause action or are the subjects that are acted upon. These are orthogonal perspectives of a system. Choose one or the other.

Object-Oriented Decomposition is Better Build smaller systems through the reuse of common mechanisms. Object-oriented systems are more resilient to change. Reduce the risk of building complex systems. Evolve incrementally from smaller systems in which we already have confidence. Help make intelligent decisions regarding the separation of concerns in a large system.

Hierarchy Hierarchical structure Object structure Class structure The architecture of a complex system is a function of its components as well as the hierarchical relationships among these components. Object structure How different objects collaborate with each other. Patterns of interaction. Class structure Common structure and behavior within a system.

What is Design? A disciplined engineering approach to invent a solution for some problem. Provide a path from requirements to implementation.

The Purpose of Design in Software Engineering Satisfy a given (perhaps informal) Functional Specification. Conform to limitations of the target medium. Meet implicit or explicit requirements on performance and resource usage. Satisfy implicit or explicit design criteria on the form of the artifact. Satisfy restrictions on the design process itself, such as its length or cost, or the tools available for doing the design. “Toward Better Models of the Design Process” by J. Mostow AI Magazine vol. 6(1), Spring 1985, p. 44.

Analysis Precedes Design Understand the problem. The application is no good if it doesn’t do what it’s supposed to do. Gather requirements from the client. Create use cases to make sure you and the client agree what the application is supposed to do. You must understand the application better than your client. Know exactly what the application needs to do. Be able to anticipate problems.

The Only Thing that’s Constant ... ... in Analysis and Design is CHANGE Clients (and other stakeholders) change their minds about purpose and requirements. Market conditions change. The environment changes.

But Avoid ... Paralysis by Analysis

Where Do Classes Come From? Textual analysis Look for nouns and verbs in your use cases. Nouns  classes Some nouns are actors. Verbs  functions Class names should be nouns in the singular form, such as Inventory, Instrument, InstrumentSpec.

Where Do Classes Come From? cont’d How will the classes support the behaviors that your use cases describe? Focus on concepts, not implementation.

Categories of Classes Things Agents Examples: Instrument, InstrumentSpec Agents Represent doers of tasks. Names often end in “er” or “or” Examples: Scanner, Paginator

Categories of Classes, cont’d Events and transactions Activities that describe what happened in the past or what needs to be done later. Example: MouseEvent remembers when and where the mouse was moved or clicked. Users and roles Stand-in for the actual users of the application. Common in systems that are used by more than one person or where one person needs to perform distinct tasks. Examples: Administrator, Reviewer

Categories of Classes, cont’d System A subsystem or the overall system being built. Typical functions: initialize, shutdown, read input System interfaces and devices Interfaces to the host operating system, file system, etc. Foundation Typically the built-in classes. Examples: string, date

Class Responsibilities Responsibilities correspond to verbs in the use cases. Each responsibility should be owned by one and only one class. Common mistakes: Assigning a responsibility to an inappropriate class. Assigning too many responsibilities to a class. Ideally, each class should have a single primary responsibility.

Class Responsibilities Example class Automobile start() stop() changeTires() drive() wash() displayOilLevel() checkOil() class Automobile start() stop() displayOilLevel() class Driver drive() class CarWash wash() class Mechanic changeTires() checkOil() Too many responsibilities! A cohesive class does one thing really well and does not try to be something else.

Class Relationships: Dependency Class C depends on class D. Some function of C manipulates objects of D Example: Mailbox objects manipulate Message objects. Dependency is asymmetric. The Message class is not aware of the existence of the Mailbox class. Therefore, Message objects do not depend on Mailbox objects.

Class Relationships: Dependency, cont’d Loose coupling Minimize the number of dependency relationships. A key way for a design to handle change.

Class Relationships: Aggregation Class C aggregates class A. A special case of dependency. Objects of class C contain objects of class A over a period of time. The “has-a” relationship. Example: An Inventory object has a list of Instrument objects.

Class Relationships: Aggregation, cont’d Multiplicity 1:1 – Example: Each Person object has a single StreetAddress object. 1:n – Example: Each Inventory object has an array of multiple Instrument objects.

Class Relationships: Inheritance Class C inherits from class S. The “is-a” relationship. All class C objects are special cases of class S objects. Class S is the superclass of class C. Class C is a subclass of class S. An object of class C is an object of class S.

Aggregation vs. Inheritance Aggregation: A Mailbox object has a Message object. Inheritance: A ForwardedMessage object is a Message object.

UML Diagrams A picture is worth a thousand words! It is much easier to extract information from a graphical notation than reading a textual document. Show your design in graphical UML diagrams. UML: Unified Modeling Language

UML Diagrams There are several different types of UML diagrams. For now, we’ll mainly use: class diagrams sequence diagrams statechart diagrams

UML Class Diagram A class diagram has three compartments: Class Name Attributes : types Methods(parms : types) : return type member variables member functions

UML Class Diagram: Attributes and Methods Specify the key attributes (member variables) and methods (member functions). If you have too many attributes in a class, check if you can group them into a new class. Example: Mailbox new_messages : vector<Message> saved_messages : vector<Message> add(msg : Message) : bool get_current_message() : Message

Example: Attributes and Methods You have attributes that are specific to your class. But you also have name, street, city, state, and zip attributes. Create a new Address class to contain those attributes. Then your class has an address.

UML Class Diagram: Relationships Relationships among classes using arrows. Dependency Aggregation Inheritance Composition Association Direct association Interface implementation

UML Class Diagram: Multiplicities Multiplicity in a “has” relationship. Sign Purpose * Zero or more 1..* One or more 0..1 Zero or one 1 Exactly one

UML Class Diagram: Aggregation A “has a” relationship. The contained object can have an existence independent of its container. Example A mailbox has a set of messages. A message can exist without a mailbox. Therefore, a mailbox aggregates messages. Mailbox Message 1 *

UML Class Diagram: Composition Another “has a” relationship. The contained object cannot (logically) have an existence independent of its container. Example A mailbox has a message queue. The message queue cannot exist without a mailbox. Therefore, a mailbox composes a message queue. Mailbox MessageQueue 1

UML Sequence Diagram A class diagram is static. It shows the classes and the static relationships that exist throughout the lifetime of the system. A sequence diagram shows the dynamic relationships among the classes at run time. It shows the interactions among objects over time during run time.

UML Sequence Diagram Withdraw Cash Sequence Diagram Customer Display Keypad Bank Account select notify T I M E display confirmation enter amount notify notify display bank ads verify accept notify dispense cash Withdraw Cash Sequence Diagram

UML Sequence Diagram Underline object names to distinguish them from class names. The dashed vertical lines are lifelines. A rectangle on a lifeline is an activation bar. It shows when a object has control whiile executing a function. The activation bar ends when the function returns. The horizontal arrows are call arrows.

UML Sequence Diagram, cont’d Use a sequence diagram to illustrate complex interactions among a set of objects. Don’t show loops or branches.

Free UML Design Tools Violet: http://horstmann.com/violet/ StarUML: http://staruml.sourceforge.net/en/

Assignment #2: Design Specification Write a Design Specification for the Rock-Paper-Scissors game from Assignment #1. To be read and understood by developers. Identify the important classes (at least four) and list the set of responsibilities of each class. What is the primary responsibility? Is it cohesive? Draw UML class diagrams. Show attributes and methods. Show the relationships among the classes. Are they loosely coupled?

Assignment #2, cont’d Draw a UML sequence diagram. Suggestion: Pick one of your use cases and illustrate the interactions of your objects during the execution of the use case. Create a PDF, name it after your team, and submit into Canvas: Assignment #2. Design Specification Due Monday, September 17 at 11:59 PM.