1. Trang chủ
  2. » Trung học cơ sở - phổ thông

Object-Oriented Design II

10 14 0

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

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 10
Dung lượng 70,27 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Library the name of the system Book Journal Copy ShortTermLoan event LibraryMember Week measure MemberOfLibrary repeat.. Item book or journal6[r]

Trang 1

Object-Oriented Design II

Trang 2

Modeling Classes

Given a real-life system, how do you decide what classes to

use?

• What terms do the users and implementers use to describe the system? They are candidates for classes

• Is each candidate class crisply defined?

• For each class, what is its set of responsibilities? Are the

responsibilities evenly balanced among the classes?

• What attributes and operations does each class need to carry out its responsibilities?

Trang 3

Noun Identification: A Library Example

The library contains books and journals It may have several copies of a given book Some of the books are reserved for short-term loans only All others may be borrowed by any

library member for three weeks Members of the library can normally borrow up to six items at a time, but members of

staff may borrow up to 12 items at one time Only members

of staff may borrow journals

The system must keep track of when books and journals are

Trang 4

Noun Identification: A Library Example

The library contains books and journals It may have several copies of a given book Some of the books are reserved for short-term loans only All others may be borrowed by any

library member for three weeks Members of the library can normally borrow up to six items at a time, but members of

staff may borrow up to 12 items at one time Only members

of staff may borrow journals

The system must keep track of when books and journals are borrowed and returned and enforce the rules

Trang 5

Candidate Classes

Library the name of the system Book

Journal Copy ShortTermLoan event LibraryMember

MemberOfLibrary repeat

MemberOfStaff

Trang 6

Relations between Classes

LibraryMember

Item

Is Item needed?

Trang 7

Item not needed yet.

Trang 8

Class Diagram

MemberOfStaff

Book Copy

1 * 1

LibraryMember

1

0 *

0 12

1

on loan

on loan

Trang 9

Rough Sketch: Wholesale System

A wholesale merchant supplies retail stores from stocks of goods in a warehouse

What classes would you use to model this business?

Trang 10

Rough Sketch: Wholesale System

RetailStore

Warehouse

Order

Invoice

Product

Shipment Merchant

Ngày đăng: 26/02/2021, 10:37

TỪ KHÓA LIÊN QUAN

w