Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.

Slides:



Advertisements
Similar presentations
UML an overview.
Advertisements

Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall A.1.
Systems Analysis and Design 8th Edition
Chapter 22 Object-Oriented Systems Analysis and Design and UML Systems Analysis and Design Kendall and Kendall Fifth Edition.
CS3773 Software Engineering Lecture 03 UML Use Cases.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
Chapter 18 Object-Oriented Systems Analysis and Design Using UML
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
Lecture 11: Chapter 22 Topics –Object Oriented Modeling –UML –Use case.
OOdesignProcess1 The Object-Oriented Design Process Part 1: objects & classes.
Copyright 2004 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Second Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Appendix.
CPSC 2100 Software Design and Development
Object-oriented design Part 4: More UML. Interfaces An interface is a language construct specific to Java Java does not support multiple inheritance Interfaces.
Unified Modeling Language
Chapter 2 (Horstmann’s Book) – Part 2 The Object-Oriented Design Process Hwajung Lee.
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
Systems Analysis and Design in a Changing World, Tuesday, Feb 27
Object-Oriented Design & Patterns Cay S
Introduction to the Unified Modeling Language “The act of drawing a diagram does not constitute analysis or design. … Still, having a well-defined and.
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
CSC 395 – Software Engineering Lecture 13: Object-Oriented Analysis –or– Let the Pain Begin (At Least I’m Honest!)
CH06: Considering Objects TECH Computer Science  Set, Class, Type  …of…  Objects, Actors, Agents  Data and Actions Object-Oriented Design and Development.
CSC 480 Software Engineering OOAD Process. Topics Overview: OOAD Process The object model Identifying classes Responsibilities and collaborations Hierarchy:
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 4: Restaurant.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Systems Analysis & Design 7 th Edition Chapter 5.
IT 21103/41103 System Analysis & Design. Chapter 05 Object Modeling.
Systems Analysis and Design 8 th Edition Chapter 6 Object Modeling.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
1 Class Diagrams: The Essentials. 2 Terms and Concepts A class is... The most important building block of any object-oriented system. A description of.
UML Diagrams A tool for presentation of Architecture.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
An Introduction to the Unified Modeling Language
5 Systems Analysis and Design in a Changing World, Fifth Edition.
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
UML as a Specification Language for Embedded Systems. By, Mir Ahmed Ali, Asst. Professor, ECM department, SNIST. By, Prof. Narsiah sir, Director of School.
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,
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Analysis Modeling CpSc 372: Introduction to Software Engineering
ITEC324 Principle of CS III Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
Internet and Intranet Protocols and Applications Lecture 5a: HTTP Client-Server Design and Implementation February 15, 2005 Arthur Goldberg Computer Science.
1 Unified Modeling Language, Version 2.0 Chapter 2.
Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Appendix A Object-Oriented Analysis and Design A.1.
Chapter 6: The Analysis Workflow Chapter 7: Classes and Objects Chapter 8: Finding Analysis Classes [Arlow and Neustadt, 2005] CS 426 Senior Projects in.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
The Object-Oriented Design Process Chapter 2. Chapter Topics From Problem to Code The Object and Class Concepts Identifying Classes Identifying Responsibilities.
Chapter 12 – Object-Oriented Design
Systems Analysis and Design With UML 2
Unified Modeling Language
Introduction to Unified Modeling Language (UML)
Advanced Java Programming
A tool for presentation of Architecture
A tool for presentation of Architecture
Understand and Use Object Oriented Methods
Analysis models and design models
Copyright 2007 Oxford Consulting, Ltd
Chapter 12 – Object-Oriented Design
Chapter 5.
Chapter 22 Object-Oriented Systems Analysis and Design and UML
ITEC324 Principle of CS III
ITEC324 Principle of CS III
Presentation transcript:

Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee

 From Problem to Code  Use Cases  Identifying Classes  Identifying Responsibilities  Relationships Between Classes

 CRC Cards  UML Class Diagrams  Sequence Diagrams  State Diagrams  Using javadoc for Design Documentation  Case Study: A Voice Mail System

 Three Phases:  Analysis  Design  Implementation  Case Study: Voice Mail System

 Functional Specification  Completely defines tasks to be solved  Free from internal contradictions  Readable both by domain experts and software developers  Reviewable by diverse interested parties  Testable against reality  Artifact  Use cases

 Goals  Identify classes  Identify behavior of classes  Identify relationships among classes  Artifacts  Textual description of classes and key methods  Diagrams of class relationships  Diagrams of important usage scenarios  State diagrams for objects with highly state-dependent

 Implement and test classes  Combine classes into program  Avoid "big bang" integration  Prototypes can be very useful

 Analysis technique  Each use case focuses on a specific scenario  Use case = sequence of actions  Action = interaction between actor and computer system  Each action yields a result  Each result has a value to one of the actors  Use variations for exceptional situations

 Leave a Message 1. Caller dials main number of voice mail system 2. System speaks Enter mailbox number followed by # 3. User types extension number 4. System speaks You have reached mailbox xxxx. Please leave a message now 5. Caller speaks message 6. Caller hangs up 7. System places message in mailbox

 Variation # In step 3, user enters invalid extension number 1.2. Voice mail system speaks You have typed an invalid mailbox number Continue with step 2.  Variation # After step 4, caller hangs up instead of speaking message 2.3. Voice mail system discards empty message

 Rule of thumb: Look for nouns in problem description  Mailbox  Message  User  Passcode  Extension  Menu  Focus on concepts, not implementation  MessageQueue stores messages  Don't worry yet how the queue is implemented

 Tangible Things  Agents  Events and Transactions  Users and Roles  Systems  System interfaces and devices  Foundational Classes

 Rule of thumb: Look for verbs in problem description Behavior of MessageQueue:  Add message to tail  Remove message from head  Test whether queue is empty

 OO Principle: A responsibility must belong to exactly one class  Example: Add message to mailbox ▪ Who is responsible: Message or Mailbox?

 Dependency  "uses"  Aggregation  "has"  Inheritance  "is"

 C depends on D: Method of C manipulates objects of D  Example: Mailbox depends on Message  If C doesn't use D, then C can be developed without knowing about D

 Minimize dependency: reduce coupling  Example: Replace public class Message { void print() {System.out.println(text);} } with public String getText()  Removes dependence on System, PrintStream

 Object of a class contains objects of another class  Example: MessageQueue aggregates Messages  Example: Mailbox aggregates MessageQueue  Implemented through instance fields

 1 : 1 or 1 : relationship: public class Mailbox {... private Greeting myGreeting; }  1 : n relationship: public class MessageQueue {... private ArrayList elements; }

 More general class = superclass  More specialized class = subclass  Subclass supports all method interfaces of superclass (but implementations may differ)  Subclass may have added methods, added state  Subclass inherits from superclass  Example: ForwardedMessage inherits from Message  Example: Greeting does not inherit from Message (Can't store greetings in mailbox)

 Design Technique  CRC = Classes, Responsibilities, Collaborators  Developed by Beck and Cunningham  Use an index card for each class  Class name on top of card  Responsibilities on left  Collaborators on right

 Responsibilities should be high level  responsibilities per card  Collaborators are for the class, not for each responsibility

 Use case: "Leave a message"  Caller connects to voice mail system  Caller dials extension number  "Someone" must locate mailbox  Neither Mailbox nor Message can do this  New class: MailSystem ▪ Responsibility: manage mailboxes

 UML = Unified Modeling Language  Unifies notations developed by the "3 Amigos" Booch, Rumbaugh, Jacobson  Many diagram types  We'll use three types:  Class Diagrams  Sequence Diagrams  State Diagrams

 Rectangle with class name  Optional compartments  Attributes  Methods  Include only key attributes and methods

 any number (0 or more): *  one or more: 1..*  zero or one: 0..1  exactly one: 1

 Special form of aggregation  Contained objects don't exist outside container  Example: message queues permanently contained in mail box

 Some designers don't like aggregation  More general association relationship  Association can have roles

 Some associations are bidirectional Can navigate from either class to the other  Example: Course has set of students, student has set of courses  Some associations are directed Navigation is unidirectional  Example: Message doesn't know about message queue containing it

 Interface type describes a set of methods  No implementation, no state  Class implements interface if it implements its methods  In UML, use stereotype «interface»

 Use UML to inform, not to impress  Don't draw a single monster diagram  Each diagram must have a specific purpose  Omit inessential details

 Each diagram shows dynamics of scenario  Object diagram: class name underlined

 Use for classes whose objects have interesting states

 Recommendation: Use Javadoc comments  Leave methods blank /** Adds a message to the end of the new aMessage a message */ public void addMessage(Message aMessage) { }  Don't compile file, just run Javadoc  Makes a good starting point for code later

 Please refer details on javadoc in page 6~9 of chapter 1 (Horstmann’s book)  Ch1/helloworld/Greeter.java (page 6) Ch1/helloworld/Greeter.java