object diagrams
Download
Skip this Video
Download Presentation
Object Diagrams

Loading in 2 Seconds...

play fullscreen
1 / 12

Object Diagrams - PowerPoint PPT Presentation


  • 106 Views
  • Uploaded on

Object Diagrams. Address. Customer. Street: String city: String state: String zipCode: int. firstName: String Lastname: String id: int. Class diagram. getAddress(): Address. getCity(): String. :Customer. :Address. johnSmith :Customer. homeAddr : Address. Object diagram.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Object Diagrams' - ralph


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
object diagrams
Object Diagrams

Address

Customer

Street: String

city: String

state: String

zipCode: int

firstName: String

Lastname: String

id: int

Class

diagram

getAddress(): Address

getCity(): String

:Customer

:Address

johnSmith :Customer

homeAddr : Address

Object

diagram

homeAddr :Address

JohnSmith :Customer

Street: String

city: String

state: String

zipCode: int

firstName: String

Lastname: String

id: int

getAddress(): Address

getCity(): String

slide2

Customer

Address

firstName: String

Lastname: String

id: int

Street: String

city: String

state: String

zipCode: int

1

Class

diagram

- homeAddr

getAddress(): Address

getCity(): String

homeAddr : Address

johnSmith :Customer

Object

diagram

slide3

Customer

Address

firstName: String

Lastname: String

id: int

Street: String

city: String

state: String

zipCode: int

1..2

Class

diagram

- addresses

getAddress(): Address [1..2]

getCity(): String

homeAddr : Address

johnSmith :Customer

Object

diagram

officeAddr : Address

what can be classes
What can be classes?
  • Traditionally…
    • Nouns in a specification
  • Each class’s instances/objects should have its own identity, behavior and state.
  • Physical/logical objects
  • Identifier for each physical/logical object
  • People, organizations
  • Person’s and organization’s roles
  • Places and locations
  • Transactions made among classes
  • Events
slide5
Video rental
    • Each customer can rent up to 10 video tapes.
    • Each video tape has its own ID.
slide6
Video rental
    • Each customer can rent up to 10 video tapes.
    • Each video tape has its own ID.

Customer

VideoTape

tapesRented: VideoTape[0..10]

- id: int

- title: String

- rented: boolean

1

0..10

isRented(): boolean

rent(): void

slide7

Customer

VideoTape

tapesRented: VideoTape[0..10]

- id: int

- title: String

- rented: boolean

Class

diagram

1

0..10

isRented(): boolean

rent(): void

: VideoTape

a :Customer

00 :id

“Spiderman” :title

true : rented

Object

diagram

: VideoTape

10 :id

“Spiderman2” :title

true : rented

: VideoTape

b :Customer

01 :id

“Spiderman” :title

true : rented

slide8
What if…
    • you need to maintain individual video’s properties?
      • Rental cost, # of rentals, production company, distribution company, distribution year, director’s name, rating (R-rated, PG13, etc.), etc.
slide9

Customer

VideoTape

tapesRented: VideoTape[0..10]

- id: int

- title: String

- rented: boolean

- rentalCost: double

- directorName:String

- numRental: int

1

0..10

Class

diagram

isRented(): boolean

rent(): void

: VideoTape

a :Customer

00 :id

“Spiderman” :title

true : rented

1.00: rentalCost

“…” : directorName

1: numRental

Object

diagram

: VideoTape

b :Customer

01 :id

“Spiderman” :title

true : rented

1.00: rentalCost

“…” : directorName

10: numRental

slide11
How can we remove the redundancy?
  • Separate the properties of individual video tapes and video titles.
slide12

Title

VideoTape

- id: int

- title: String

- rentalCost: double

- directorName:String

- tapeId: int

- rented: boolean

- numRental: int

1

0..*

Class

diagram

isRented(): boolean

rent(): void

0..10

Customer

1

: VideoTape

a :Customer

00 :id

true : rented

1: numRental

: Title

Object

diagram

001 :id

“Spiderman” :title

1.00: rentalCost

“…” : directorName

: VideoTape

b :Customer

01 :id

true : rented

10: numRental

ad