1. Trang chủ
  2. » Giáo Dục - Đào Tạo

The object oriented design process (THIẾT kế đối TƯỢNG SLIDE)

64 12 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Slide 1

  • Topics

  • From Problem to Code

  • Analysis Phase

  • Design Phase

  • Implementation Phase

  • Case Study: Voice Mail System

  • Identifying Classes

  • Categories of Classes

  • Identifying Responsibilities

  • Identifying Class Relationships

  • Dependency Relationship

  • Association

  • Aggregation

  • Composition

  • Association Direction

  • Multiplicities

  • Multiplicities

  • Generalization - Inheritance relationship

  • Generalization - implementation relation

  • Use Cases

  • Use-Case Model

  • Sample Use Case

  • Sample Use Case -- Variations

  • CRC Cards

  • CRC Cards

  • CRC Cards

  • How do you create CRC models

  • Walkthroughs

  • Walkthroughs

  • Other UML Diagrams

  • Sequence Diagrams

  • Sequence Diagrams

  • State Diagram

  • Design Documentation

  • Case Study: Voice Mail System

  • Voice Mail System

  • Use Case: Reach an Extension

  • Use Case: Leave a Message

  • Use Case: Log in

  • Use Case: Retrieve Messages

  • Use Case: Retrieve Messages

  • Use Case: Change the Greeting

  • Use Case: Change the Passcode

  • CRC Cards for Voice Mail System

  • Initial CRC Cards

  • Telephone

  • Connection

  • Analyze Use Case: Leave a message

  • Result of Use Case Analysis

  • Result of Use Case Analysis

  • Analyse Use Case: Retrieve messages

  • Analyse Use Case: Retrieve messages

  • Result of Use Case Analysis

  • CRC Summary

  • UML Class Diagram for Mail System

  • Dependency Relationships

  • Aggregation Relationships

  • UML Class Diagram for Voice Mail System

  • Sequence Diagram for Use Case: Leave  a message

  • Interpreting a Sequence Diagram

  • Sequence Diagram: Retrieve messages

  • Connection State Diagram

  • Final Class Diagram for Voice Mail System

Nội dung

The Object-Oriented Design Process Topics • • • • • • • • • • From Problem to Code Identifying Classes Identifying Responsibilities Relationships Between Classes Use Cases CRC Cards UML Class Diagrams Sequence Diagrams State Diagrams Case Study: A Voice Mail System From Problem to Code • Three Phases: – Analysis – Design – Implementation Analysis Phase • Establish the functions, services, and constraints of the software to be developed – The developers and the software users work together to produce a requirements specification, which will be the input to the design phase • Functional Specification is a part of requirements specification It has the following characteristics: – 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 Design Phase • 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 rich state Implementation Phase • Implementation is the realization of the software design in a specific programming language • Each unit (a single class) is implemented separately • Unit testing is done to ensure that each unit functions properly with respect to its specification before the units are integrated • The individual units are integrated and tested as a whole to ensure that the entire software system works properly conforming to its specification Case Study: Voice Mail System • Program that simulates a telephone voice mail system • The system has a collection of mailboxes, each of which may be accessed by an extension number • Use text for voice, phone keys, hangup • # on a single line means key • H on a single line means "hang up" • All other inputs mean voice • In GUI program, will use buttons for keys Identifying Classes • 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 Categories of Classes • Tangible Things • Agents • Events and Transactions • Users and Roles • Systems • System interfaces and devices • Foundational Classes Identifying Responsibilities • Rule of thumb: Look for verbs in problem description • An example: Behavior of MessageQueue: – Add message to tail – Remove message from head – Test whether queue is empty • OO Principle: Every operation is the responsibility of a single class – Example: Add message to mailbox – Who is responsible: Message or Mailbox? 10 Result of Use Case Analysis 50 Result of Use Case Analysis 51 Analyse Use Case: Retrieve messages User types in passcode Telephone notifies Connection Connection asks Mailbox to check passcode – Add responsibility "manage passcode" to Mailbox Connection sets current mailbox and asks Telephone to speak menu User selects "retrieve messages" Telephone passes key to Connection Connection asks Telephone to speak menu User selects "listen to current message" Telephone passes key to Connection 52 Analyse Use Case: Retrieve messages Connection gets first message from current mailbox – Add "retrieve messages" to responsibility of Mailbox – Connection asks Telephone to speak message Connection asks Telephone to speak menu User selects "save current message" Telephone passes key to Connection 10.Connection tells Mailbox to save message – Modify responsibility of Mailbox to "retrieve, save, delete messages" 11.Connection asks Telephone to speak menu 53 Result of Use Case Analysis 54 CRC Summary • One card per class • Responsibilities at high level • Use scenario walkthroughs to fill in cards • Usually, the first design isn't perfect 55 UML Class Diagram for Mail System • CRC collaborators yield dependencies • Mailbox depends on MessageQueue • Message doesn't depends on Mailbox • Connection depends on Telephone, MailSystem, Message, Mailbox • Telephone depends on Connection 56 Dependency Relationships 57 Aggregation Relationships • A mail system has mailboxes • A mailbox has two message queues • A message queue has some number of messages • A connection has a current mailbox • A connection has references to a mailsystem and a telephone 58 UML Class Diagram for Voice Mail System 59 Sequence Diagram for Use Case: Leave a message 60 Interpreting a Sequence Diagram • Each key press results in separate call to dial, but only one is shown • Connection wants to get greeting to play • Each mailbox knows its greeting • Connection must find mailbox object: Call findMailbox on MailSystem object • Parameters are not displayed (e.g mailbox number) • Return values are not displayed (e.g found mailbox) • Note that connection holds on to that mailbox over multiple call 61 Sequence Diagram: Retrieve messages 62 Connection State Diagram 63 Final Class Diagram for Voice Mail System 64 ... of aggregation – The aggregate class exclusively owns the component class – The lifetime of the components is entirely included in the lifetime of the aggregate – Contained objects don't exist... Analysis – Design – Implementation Analysis Phase • Establish the functions, services, and constraints of the software to be developed – The developers and the software users work together to produce... association – Represents the has-a or part-whole relationship – Simply a structural relationship that distinguishes the whole, that is, the aggregate class, from the parts, that is, the component class

Ngày đăng: 29/03/2021, 14:51

w