Introduction to Object-Oriented Design and the UML - PowerPoint PPT Presentation

About This Presentation
Title:

Introduction to Object-Oriented Design and the UML

Description:

Need modeling notation that highlight tight relationship between data & processes ... class should have at least two methods (checkIfDelinquent and borrowBook) ... – PowerPoint PPT presentation

Number of Views:12
Avg rating:3.0/5.0
Slides: 21
Provided by: johnpaul5
Category:

less

Transcript and Presenter's Notes

Title: Introduction to Object-Oriented Design and the UML


1
Introduction toObject-Oriented Designand the UML
2
Object-Oriented Modeling
  • UML Unified Modeling Language
  • Emerging OO Modeling Standard
  • What is depicted?
  • System functionality
  • Class details and static relationships
  • Object interaction
  • State transition within an object

3
Modeling Techniques
  • Use Cases/Use Case Diagrams
  • Class Diagrams
  • CRC Cards
  • Interaction Diagrams
  • State Diagrams

4
ExampleUse Case Diagram
LIBRARY SYSTEM
Facilitate Borrow
Search for Book
Borrower
Librarian
Facilitate Return
5
Class Diagramsand CRC Cards
  • Class Diagrams similar to ER Diagrams but in
    addition, it incorporates
  • methods, not just attributes for each entity
  • inheritance
  • Class-Responsibility-Collaboration Cards
  • technique that depicts responsibilities of
    classes with respect to other classes (hints on
    both data and behavior details)

6
ExampleInteraction Diagram
2 checkIfAvailable()
Borrow Screen
Book
1 checkIfDelinquent() 3 borrowBook()
4 setBorrower()
Borrower
7
ExampleState Diagram (Book)
start
Reserved
Borrowed
New
Librarian activates book as available
Borrower returns book
Available
8
Object-Oriented Design Models
  • Static Model
  • Class Diagrams
  • Dynamic Model
  • Use Cases, Interaction Diagrams, State Diagrams,
    others

9
OO Static Model
  • Class Diagrams
  • Relationships
  • Association
  • Aggregation/Composition
  • Inheritance
  • Attribute and Method names

10
Classes in a Class Diagram
  • Class name only Example
  • With Details Example

Bank Account
Class Name
Bank Acct double balance deposit() withdraw()
Class Name attributes methods
11
Relationships
  • Inheritance (arrow)
  • example between Secretary and Employee
  • Composition/Aggregation (diamond)
  • example between Car and Wheel
  • Association (line)
  • example between Borrower and Book

12
Inheritance
Employee
public class Secretary extends Employee
Secretary
13
Composition
Car
Wheel
4
w
public class Car Wheel w ...
public Car() w new Wheel4
...
14
Association
Borrower
Book
0..3
0..1
currBorr
bk
public class Borrower Book bk
public Borrower() bk new Book3
public class Book Borrower currBorr
15
OO Dynamic Model
  • Goal Represent
  • Object behavior
  • Object interaction
  • Traditional (relational) Dynamic Modeling
  • Data Flow Diagrams (DFDs)
  • Problem Processes separate from data
  • Need modeling notation that highlight tight
    relationship between data processes

16
DFD Example(Inventory Management)
Accept and Post Delivery
Delivery info
Transaction
Item Master
17
OO CounterpartObject Interaction
new (delivery info)
Encoder
Transaction
post (item count)
Item Master
18
Interaction Diagrams
  • Rectangles Classes/Objects
  • Arrows Messages/Method Calls
  • Labels on Arrows
  • sequence number
  • method name
  • more details, when necessary (conditions,
    parameters, types, return types)

19
Interaction Diagram Borrow-Book Example
2 avail checkIfAvailable()boolean
Borrow Screen
bBook
1 delinq checkIfDelinquent()boolean 3!delinq
avail borrowBook(Book b)
4 setBorrower(r)
rBorrower
20
Methods
  • Interaction Diagrams suggest methods for classes
  • consequence on detailed class diagram
  • The label(s) of an arrow should be a method of
    the class the arrow points to
  • Library System
  • Borrower class should have at least two methods
    (checkIfDelinquent and borrowBook)
Write a Comment
User Comments (0)
About PowerShow.com