Sunteți pe pagina 1din 46

Chapter 18 Systems Analysis and Design Instructor's Manual 18-1

1 Chapter 18
Object-Oriented Systems
Analysis and Design Using UML

Key Points and Objectives

1. Object-oriented systems describe entities as objects.

2. Objects are generalized into classes, which describe a specific object in


terms of its similarities and differences from members of its own class.

3. An attribute describes some property that is possessed by all objects of a


class.

4. A method is an action that cam be requested from any object of the class.

5. Classes can inherit attributes and methods from other classes.

6. Class, responsibilities, and collaborators (CRC) cards are used to


represent the responsibilities of classes and the interaction between the
classes. Analysts create CRC cards by:

A. Finding all the nouns and verbs in a problem statement.


B. Create scenarios that are actually walkthroughs of system
functions.
C. Identify and refine responsibilities into smaller and smaller
tasks, if possible.
D. The group determines how tasks are fulfilled by objects or
interacting with other things.
E. Responsibilities evolve into methods or operations.

7. The Unified Modeling Language (UML) is a notation for modeling object


oriented systems.

8. UML has three categories:

A. Things, the objects.


B. Relationships, the glue that holds things together.
C. Diagrams, categorized as either structure or behavioral.

9. The most commonly used UML diagrams and documentation are:

A. A use case diagram.


B. A use case scenario (not a diagram).
C. An activity diagram.
D. A sequence diagram.
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-2

E. A class diagram.
F. A statechart diagram.

10. A use case model shows what the system does without describing how the
system does it.
Chapter 18 Systems Analysis and Design Instructor's Manual 18-3

11. A use case describes three things:

A. An actor (user) that initiates an event.


B. An event that triggers a use case.
C. The use case that performs the actions triggered by the event.

12. There are four active behavioral relationships:

A. Communicates, is used to connect an actor to a use case.


B. Includes, describes the situation where a use case contains a
behavior that is common to more than one use case.
C. Extends, describes the situation where one use case
possesses the behavior that allows the new use case to handle a
variation or exception.
D. Generalizes, implies that one thing is more typical than the
other thing.

13. The steps required to create a use case model are:

A. Review the business specifications and identify the actors


within the problem domain.
B. Identify the high-level events and develop the primary use
cases that describe the events and how actors initiate them.
C. Review each primary use case to determine possible
variations of flow through the use case.
D. Develop the use case documents for all primary use cases and
all important use case scenarios.

14. An activity diagram is created for one use case and shows the different
possible scenarios. Activity diagrams include:

A. Decisions, shown by a diamond.


B. Parallel activities.
C. Sequential activities.
D. Partitioning, using swimlanes.

15. Activity diagrams are useful for viewing the overall activities of a use case
and for dividing the project into various team members.

16. A message queue is an example of middleware used to transfer data


between a server and mainframe.

17. Sequence diagrams illustrate a succession of interactions between either


classes or objects over time. Sequence diagrams:
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-4

A. Show the starting object, either an actor or an interface, on the


left.
B. Classes along the top of the diagram.
C. A vertical line indicating the time from when an object is
created until it is destroyed.
D. A lateral bar showing when the class or object is busy doing
things.
E. Horizontal arrows showing messages and optional parameters
that are sent between classes.
F. The timing, with the first activities shown at the top of the
diagram.

18. The rules for creating sequence diagrams are that all interface classes
must be connected to a control class. All entity classes must be connected
to a control class as well.

19. Each message should be described in a data dictionary.

20. Communication (called collaboration in UML 1.0) diagrams show how two
or more things perform a behavior that an individual thing cannot do alone.
They show the same information as a sequence diagram, but use numbers
to indicate the order of the activities.

21. Class diagrams show classes and the relationships between classes.

22. Class diagrams include:

A. A rectangle, representing a class.


B. Attributes, along with notation to indicate whether attributes
are private, public, or protected.
C. Methods used by the class.

23. Method overloading is when a method may be defined more than once in a
class, and used differently. The number of parameters or the type of
parameter must be different.

24. There are several types of classes:

A. An entity class, storing information about real-world objects.


B. A boundary or interface class, showing user or other
interfaces.
C. Abstract classes used in generalization/specialization
relationships.
D. Control classes that coordinate the activities of other classes.
Chapter 18 Systems Analysis and Design Instructor's Manual 18-5

25. Each type of class has a special symbol, called a stereotype, and extension
to the UML.

26. Data may be stored and re-transmitted between Web pages using one of
three methods:

A. In the URL or location for the Web page.


B. As a cookie or small file on the client or browser computer.
Since there are limits to how many cookies a Web site may set, there
must be some central control over who gets to set a cookie and the
names used within the cookie.
C. As a hidden field on a Web form.

27. Relationships are associations between classes. There are several types
of relationships:

A. Associations, showing the connection between classes.


Multiplicity refers to the type of association, such as one to many or
many to many.
B. Whole/part relationships, where one class represents the
whole and other classes represent parts contained in the whole.
C. Aggregation, which is a weaker form of a whole/part
relationship. The whole may be removed but the parts still exist.
D. Collection is a weak whole/part relationship, where the whole
retains its identity if the parts change.
E. Composition, a strong whole/part relationship where the parts
are removed if the whole is removed.

28. Generalization/specialization (gen/spec) diagrams show the relationship


where a general class that has specialized subclasses.

29. Inheritance is when a specialized class inherits attributes and methods


from the general class.

30. Polymorphism or method overriding is when a specialized class (or


subclass) changes or overrides a method inherited from the general class
(or superclass).

31. Abstract classes are general classes or superclasses, and may not have
any direct objects themselves. Only the specialized classes may create
new objects.

32. A CRUD matrix may be used to help determine class methods.


Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-6

33. Statechart (or state transition) diagrams show the different states that an
object may exist in and the events that cause an object to transition to a
different state.

34. A deferred event is one that is held until an object changes to a state that
can handle the event.

35. Events fall into three categories:

A. Signals or asynchronous messages, where the calling


program does not wait for a returning message.
B. Synchronous messages, where the calling program waits for a
returning message.
C. Temporal events, which occur at a predestined time.

36. Packages are groups of things and show partitioning.

37. Other UML diagrams include:

A. Component diagrams, showing an overview of the system


architecture.
B. Deployment diagrams, illustrating the physical implementation
of the system, including the hardware, relationships between
hardware and the system on which it is deployed.
C. Annotational things, which are notes that can be attached to
anything.

38. The steps used in UML are:

A. Define the use case model.


B. Derive the activity diagrams.
C. Create sequence and collaboration diagrams.
D. Develop class diagrams.
E. Draw statechart diagrams.
F. Refine the UML diagrams and use the to derive classes,
attributes and methods.

Consulting Opportunity 18.1 (p. 713)

Making the Magic Reel

The following CRC cards summarize the classes, responsibilities and


collaborators, as well as the “knows” and attributes for the FilmMagic chain of
stores.
Chapter 18 Systems Analysis and Design Instructor's Manual 18-7

Class Name: Rental


Superclasses:
Subclasses:
Responsibilities Collaborato Object Think Property
rs
Verify rental card Customer I know which customer CustomerID
rented
Check late fee Customer I know the date I occur RentalDate
Calculate payment RentalItem I know the total payment Payment
(incl. fee)
Collect payment I know payment method PaidBy

Class Name: RentalItem


Superclasses:
Subclasses:
Responsibilities Collaborato Object Think Property
rs
Generate due date I know the due date DueDate
Check rental price Video I know the return date ReturnDate
Process item return Customer I know how to calculate LateFee
late fee
I know my rental price RentalPrice

Class Name: Customer


Superclasses:
Subclasses:
Responsibilities Collaborato Object Think Property
rs
Provide balance due I know my rental card ID CustomerID
Provide rental card I know my current balance BalanceDue
ID due
I know my other identity ID
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-8

Class Name: Video


Superclasses:
Subclasses:
Responsibilities Collaborato Object Think Property
rs
Provide rental price I know my identity VideoID
I know my rental price RentalPrice

Consulting Opportunity 18.2 (p. 723)

Recycling the Programming Environment

Analysis...

This seems to be a case where several seemingly dissimilar objects, such as


monorail trains and warehouse robots, actually share common attributes and
behaviors. This is an ideal setting for object-reuse.

Problem definition...

Object reuse, of course, depends on the nature of the original objects. For
example, if the monorail and the mailroom objects have been designed and
developed without object-oriented design techniques and languages, it will be
very difficult to isolate the program code that manipulates the related data.
However, if the original work is object-oriented, the objects can be used as base
objects whose attributes and behaviors are selectively incorporated in creating
the warehouse robot objects. This reuse first occurs in the analysis and design
phase (reusing the design of the original objects), and secondly in the
programming stage (reusing the program code of the original objects).

Object-oriented solutions

How should Lisa go about reusing the work on the monorail in their current task
of creating a trolley object?

Although reuse design is typically discussed as a component in the design stage


of O-O projects, it does surface much earlier in a real project, typically arising in
prototypes during analysis. Lisa should immediately explore the analysis of this
object in depth. They would begin by sketching out an inheritance design in
which the robot is depicted as a derived object with train as the base object.
Other objects from the monorail may be naturally reused as base objects, such as
track and carriage. The base objects of track and carriage would follow their
derived classes into the design.
Chapter 18 Systems Analysis and Design Instructor's Manual 18-9

After sketching the design, Lisa should construct a partial prototype of the
warehouse robots to explore the feasibility of this reuse. Using object-oriented
languages or tools, she should develop enough new code to prove that the reuse
is feasible and useful in a practical sense. Once this is completed, and if the
prototype is convincing, then parts of the prototype program code can be used to
define objects and the object's attributes and behaviors.

Consulting Opportunity 18.3 (p. 744)

Developing a Fine System That Was Long Overdue: Using Object-Oriented


Analysis for the Ruminski Public Library System

UML itself only provides a set of notations for describing, analyzing, and
visualizing system requirements and designs, and it doesn't provide a pre-fixed
procedure or step-by-step instructions to do object-oriented (O-O) analysis and
design. In this case, we'll use the use case diagram, flow of events, and scenario
of UML to describe and determine domain requirements of end-users and
customers. Based on that, we'll proceed with O-O systems analysis and design
by determining the list of candidate objects as well as classes, drawing sequence
diagrams to describe interactions between objects, and working out class
diagrams.

1. Use Case Diagram

Use case diagram represents the functionality of a system, i.e., what is the
system required to do for end-users from the perspective of an end-user? The
diagram is shown below.

2. Flow of Events and Scenario Analysis


Flow of Events essentially documents the functionality of a use case, i.e., what
the use case can do from an end-user's perspective. A scenario is an instance of
a use case and it emphasizes how a use case is realized as interactions of related
objects, which forms a basis for drawing interaction diagrams of UML such as
sequence diagram. Samples of flow of events and scenarios of use cases are
shown on the next page.
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-10

Borrow Title/Copy Create New Title/Copy

User

Reserve Title/Copy Update/Remove Title/Copy

Library Staff
Return Title/Copy Create New User

Cancel Reservation Update/Remove User


Check Loan Overdue

 The Borrow Title/Copy Use Case

Flow of Events:
[1] A user enters his/her ID and associated password to log in to the library
system, which will be validated by the system.
[2] The user searches for a book/journal that he/she wants to borrow from the
library, and locate the copy of the book/journal from the bookshelf based
on the call number given by the search result.
[3] Both the user's library card and the copy are scanned into the system, and
the system checks if the borrowing criteria are met.
[4] Title/copy information as well as the user's borrowing records are updated
accordingly.
[5] If the copy has been previously reserved by the user, the reservation is
cancelled.
[6] The use case ends with the printout of a due-date notice.
[7] The user logs out of the system finally.

Alternative Flows:
[1] An invalid user ID or password is entered and the system prompts the user
to enter the ID or password again.
[2] No title name is matched from the search of the library system, and the
system prompts the user to change key words and submit the search
again.
[3] The system detects that the user hasn't returned a long overdue book, and
suggests to the user that he/she must return the book before he/she can
borrow any additional books/journals.
Chapter 18 Systems Analysis and Design Instructor's Manual 18-11

Scenario:
 Mario enters his ID no."481" and password “pizza” into the login form of
the library system. The system validates the login and Mario enters into the
system.
 The system's main menu appears on the screen and Mario chooses the
search function. A search form appears on the screen. He searches for the
book “World’s Wildest Animals” from the system and locates the book on
the bookshelf based on the call number given by the searching result.
 His library card and the book's bar-code are scanned into the system and
the system checks to see whether Mario still has overdue books/journals or
other borrowing requirements are met.
 If the book was reserved by Mario before, the system cancels the
reservation from the reservation record.
 The system updates Mario's borrowing records as well as the records of
the title/copy.
 The system prints out the due-date notice.
 Mario logs out.

 The Add Title/Copy Use Case

Flow of Event:
[1] This use case begins with a designated library staff entering his/her ID and
associated password into the system, and the system subsequently
validates the ID and password.
[2] After the staff selects the menu of ‘add title/copy’ from the system, he/she
enters the information of the title/copy such as the title name, authors'
names, ISBN number, the copy number or code, etc., and then save the
information.
[3] This use case ends when the title/copy is successfully added into the
system and the staff logs off.

Alternative Flows:
[1] An invalid user ID or password is entered and the system prompts the user
to enter the ID or password again.
[2] After the title name is input, the system searches and finds out that the title
name exists already in the system. The staff is prompted to enter a different
title name unless it is the same title but a different copy of the title.

Scenario:
 Fabio enters his staff ID no. “007” and associated password “pp7” and the
system validates the login.
 The system's main menu appears on the screen and Fabio chooses the
"Add Title/copy" function. The "Add Title/copy" form appears on the
screen. He then enters the title “Mary had a little lamb,” the author “Kool
Kev,” the publisher “Polar Duck,” and the ISBN “0-201-57169-5,” etc.
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-12

 After all relevant information is input, he clicks on the "Save" button on the
screen. The information of the title/copy is saved.
 The system prompts the staff that the title/copy “Mary had a little lamb” is
successfully added to the system.
 Fabio logs off.

3. Determine Candidate Objects

Based on the flow of events and scenarios of use cases, a list of candidate
objects can be determined, as shown below (not an exhaustive list of candidate
objects).

[1] Main menu form - A list of all functions available for a user and/or a library
staff to choose.
[2] Login form - A form used for login validation of the library system.
[3] Search form - A form for a user to input key words in order to retrieve suitable
title/copy of book/journal.
[4] Title/copy form - A form for a library staff to input information of a title/copy
into the system's catalogue.
[5] Reservation record - An object that maintains reservation records of a user.
[6] A user's borrowing record - An object that maintains borrowing records of a
user.
[7] Reservation form - A form for a user to reserve a title/copy when the copy is
lent out of the library.
[8] Title - An object that maintains all information related to the title of a book or
journal.
[9] Copy - An object that maintains all information related to the copy of a title.
[10] Printout - A notice with the information about the due date of a borrowed
book/journal.

4. CRC Cards for Classes

Card Name: User's Borrowing Record


Superclass: NIL
Role: Maintain a user's borrowing record history
Responsibilities: - Create a new borrowing record for a user
- Update the borrowing records of a user
- Remove the borrowing records of a user
Collaboration: User Record; Printout; Borrowing Manager.

Card Name: Title


Superclass: NIL
Role: Maintains title records of a book/journal.
Responsibilities: - Create a new title record
- Update existing title records
Chapter 18 Systems Analysis and Design Instructor's Manual 18-13

- Remove existing title records


Collaboration: Copy; Borrowing Manager.

Card Name: User Record


Superclass: NIL
Role: Maintain User's Information.
Responsibilities: - Add a new user
- Update an existing user
- Remove an existing user
Collaboration: User's Borrowing Record; Lending Record;
UserRecord Manager.

5. Sequence Diagrams

A sequence diagram is a graphical representation of a scenario of a user case,


and it describes interactions between objects as described in the scenario. For
more complicated interactions of objects of a use case, a new type of object –
Manager object – is added, which takes care of the coordination and control of
interactions between objects. Sequence diagrams of some important use cases
of the library system are shown on the next few pages.

M ain M enu T itle/C opy A ddT itle T itle C opy R eservation


M ary
Form M anager R ecord

1: enter_Id(user_Id, passw ord)

2: validate_user(passw ord, user_Id)

3: C hoose "A dd T itle/copy" function


4: D isplay()

5: A dd("T itanic/copy2")
6: A dd( )
7: A dd()
8: A dd()

9: U pdate reservation record


Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-14

M ain M enu R eservation R eservation R eservation


Joe : U ser/S taff
Form M anager R ecord

1: U ser(passw ord, user_Id)

2: validate_U ser("z333", "passw ord1")

3: C hoose "R eserve" function


4: D isplay()

5: R eserve("T itanic")
6: R eserve("T itanic")

7: R eserve("T itanic')
Chapter 18 Systems Analysis and Design Instructor's Manual 18-15

M a in S e a rc h B o rro w in g B o rro w in g T itle C opy U se r's B o rro w in g R e se rv a tio n P rin to u t


Jo e : U se r
M enu F o rm F o rm M anager R e c o rd R e c o rd

1 : e n te r_ ID (u se r_ ID , p a ssw o rd )

2 : v a lid a te _ u se r(u se r_ ID , p a ssw o rd )

3 : C h o o se "S e a rc h " fu n c tio n

4 : d isp la y( )

5 : S e a rc h ("W o rld 's W ild e st A n im a ls")


6 : S e a rc h ( )
7 : T h e title e xists?

8 : Is a c o p y a v a ib le ?
9 : B o rro w ()

1 0 : D isp la y()

1 1 : B o rro w ("W o rld 's W ild e st A n im a ls")

1 2 : U p d a te b o rro w in g re c o rd

1 3 : U p d a te re se rv a tio n re c o rd

1 4 : U p d a te C o p y In fo .

1 5 : P rin to u t th e b o rro w in g n o tic e

1 6 : P rin to u t()
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-16

M ain M enu U serForm U pdateU ser U ser's Borrow ing U serR ecord
M ary:Staff
M anager R ecord

1:enter_Id(user_Id,passw ord)

2:validate_user(passw ord,user_Id)

3:Choose "U pdate/R em ove U ser" function

4:D isplay()

5:U pdate/R em ove("Joe")

6:U pdate/R em ove()

7:U pdate/R em ove()

8:U pdate/R em ove()


Chapter 18 Systems Analysis and Design Instructor's Manual 18-17

M a in M e n u R e tu rn F o rm R e tu rn U se r's B o rro w in g R e se rv a tio n


Jo e : U se r
M anager R e c o rd R e c o rd

1 : e n te r_ Id (u se r_ Id , p a ssw o rd )

2 : v a lid a te _ u se r(p a ssw o rd , u se r_ Id )

3 : C h o o se "R e tu rn C o p y" fu n c tio n

4 : D isp la y()

5 : R e tu rn ("T ita n ic ")


6 : R e tu rn ()

7 : U p d a te ()

8 : U p d a te ()

5. Class Diagrams

Based on interactions of the above sequence diagrams, the top-level class


diagram that only shows the relationships between main classes is shown on the
next page.
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-18

Title/Copy Form 0..1 Add Title/copy Manager 0..1 Title 1 Copy


1 (from ManagerClass) 0..* (from EntityClass) 0..* (from EntityClass)

1 1..* 0..* 0..* 0..* .

0..1
Reservation Manager Reservation Record
(from ManagerClass) 1 0..*
1 0..* 0..*

1 0..1 1 1 1
MainMenu Reservation Form ReturnManager
1 1 (from ManagerClass)

0..*
Printout UserRecord
(from EntityClass) (from EntityClass)
1 1

0..*
1 0..1
1..*
BorrowingForm BorrowingManager BorrowingRecord
0..1 1 (from ManagerClass) 1 0..*

We can group some classes together and put them into packages, and then we
have following simplified package diagram, as shown below.

ManagerClass

EntityClass
InterfaceClass

Messages passed between objects in sequence diagrams indicate what attributes


and operations a class should have. As a result, we have following main classes
with some key attributes and operations defined for each package, as shown on
the next page.
Chapter 18 Systems Analysis and Design Instructor's Manual 18-19

BorrowingManager

Search() ReservationManager
Borrow()
UpdateReserve() AddReserve()
UpdateLendRecord() Update()
UpdateBorrowingRecord() Remove()
Printout()

ReturnManager
AddTitle/copyManager
Return()
UpdateReserve() Add()
UpdateLendRecord() UpdateReserve()
UpdateBorrowingRecord()
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-20

MainMenu BorrowingForm
Title UserId
MenuItem CallNo
BorrowDate
display() 1 DueDate
SelectItem() 1
1 1 display()
add()
update()
remove()
1
Title/CopyForm
TitleName
AuthorName ReservationForm
Publisher
1 TitleName
ISBN
UserId
YearPublished
ReserveDate
CallNo
display()
display()
add()
AddTitle()
update()
UpdateTitle()
remove()
RemoveTitle()
Chapter 18 Systems Analysis and Design Instructor's Manual 18-21

UserRecord
ReservationRecord
UserID
BorrowingRecord UserName Title Name
UserId Address ReservedUserID
CallNo PhoneNo ReserveDate
BorrowDate Position CollectionDateB4
DueDate DateJoin
ReturnDate ExpireDate add()
EmailAddress 0..* check()
0..* 1 0..* delete()
add() FaxNo
delete() Update()
update() add() IsAvailable()
CheckOverDue() 1..* update()
Printout() remove()
0..1
0..1 Check()

Printout
(f rom Logical View)
0..* Ti tle of the printout 0..*
Copy Body of the printout
Title
CallNo
TitleName Printout() TitleName
PublisherYear AuthorName
ISBN NumberOfCopy
Publisher
Add()
0..* 1 Update()
Add()
Update() Remove()
Remover() IsAvailable()
IsAvailable()

Consulting Opportunity 18.4 (p. 747)

C-Shore++

The way to manage a systems development process that does not have a fixed or
constant business processes as part of its goal set is to create a set of
independent objects that have minimal interactions with each other. The
interactions, or messages passed, should be designed so that making a change
in one object will have a minimal or no impact on another object.

Answers to Review Questions

1. List two reasons for taking an object-oriented approach to systems


development.

Two reasons for taking an object-oriented approach to systems


development are to build systems that are responsive to a changing
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-22

business landscape, and when systems are undergoing continuous


maintenance, adaptation, and redesign.

2. Describe the difference between a class and an object.

The difference between an Object and a Class is that the class defines
shared attributes and behaviors of objects. An object is an instance or
occurrence of a class.

3. Explain the concept of inheritance in object-oriented systems.

Inheritance is when a child or derived class is created from a parent or


base class. The child class inherits all the attributes and behaviors of the
parent class.

4. What does CRC stand for?

CRC stands for class, responsibilities, and collaborators.

5. Describe what Object Think adds to the CRC card.

Object think adds information written in plain English about the properties
of an object and helps to clarify thinking about the object.

6. What is UML?

UML (Unified Modeling Language) is the result of a collaboration of


individual object-oriented methods that has been adopted as a standard for
modeling object-oriented systems.

7. What are the three major elements of UML?

The major components or primary elements of UML are:

A. Things, the objects.


B. Relationships, the glue that holds things together.
C. Diagrams, categorized as either structure or behavioral.

8. List what the concept of structural things includes.

The concept of structural things includes:

A. Classes, which have properties or attributes and methods or


operations.
B. Interfaces, the behavior of a class or component of a system that is
noticeable from outside the class or component.
Chapter 18 Systems Analysis and Design Instructor's Manual 18-23

C. Collaborations, which describe the interactions of two or more


things in a system that perform a behavior that is more than any one
of the things can do alone.
D. Use cases, which describe a series of actions that demonstrate a
distinct behavior of the system and its interactions with the actors.
E. Control or active classes. A control class can initiate and control an
independent flow of activity within the system.
F. Components, which are a physical part of a system that represents
the services and interfaces implemented by the elements contained
within that component, including software code.
G. Nodes, which represent a piece of hardware on which your system
executes. Components are physically deployed on nodes.

9. List what the concept of behavioral things includes.

The concept of behavioral things includes interactions, the messages sent


between a set of objects, and state machine, a series of states that an
object goes through in response to actions within the system.

10. What are the two main types of diagrams in UML?

The two main types of diagrams in UML are structural diagrams and
behavioral diagrams.

11. List the diagrams included in structural diagrams.

Structural diagrams include:

A. Class diagrams, used to model the static structural design of a


system.
B. Object diagrams, which portray the state of class instances and their
relationships at a point in time.
C. Component diagrams, which show an overview of the system
architecture.
D. A deployment diagram, which illustrates the physical implementation
of the system, including the hardware.

12. List the diagrams included in behavioral diagrams.

Behavioral diagrams include:

A. Use case diagrams, showing the actors and the use cases.
B. Sequence diagrams that depict a succession of interactions between
object instances over time and they show the processing described
in use case scenarios.
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-24

C. Communication diagrams illustrate a sequence of object interactions


showing the organization of the objects during the interactions.
D. State chart diagrams show the states of an object and the events and
conditions that trigger a transition from one state to another.
E. Activity diagrams show the flow of activities within a process.

13. What is it that a use case model describes?

A use case model reflects the view of the system from the perspective of
the user outside the system. It describes what the system does, rather
than how the system works.

14. Would you describe a use case model as a logical or physical model of the
system? Defend your answer in a paragraph.

A use case model is a logical model because it describes what the system
does, rather than how the system works.

15. Define what an actor is in a use case diagram.

An actor is a role of a user that is external to the system. An actor may be


a person, another system, or a device such as a keyboard.
Chapter 18 Systems Analysis and Design Instructor's Manual 18-25

16. What three things must a use case always describe?

The three things that a use case must describe are the actor that initiates
the event, the event that triggers the use case, and the use case that
performs the actions triggered by the event.

17. What does an activity diagram depict?

An activity diagram depicts a sequence of activities, including sequential


and parallel activities, and decisions that are made.

18. Write a paragraph that describes the use of swimlanes on activity


diagrams.

Swimlanes on an activity diagram are used to show partitioning, such as


which activities are done on which platform, or by which user group.

19. What can be depicted on a sequence or communication diagram?

A sequence or collaboration diagram shows a series of interactions


between classes or object instances over time.

20. Why is defining classes such an important object-oriented analysis task?

Defining classes is an important object-oriented analysis task because


programming occurs at the class level.

21. What can be shown on a class diagram?

Class diagrams show classes, attributes, methods (or operations), and the
relationships between classes.

22. Define method overloading.

Method overloading means using the same method or operation several


times within a class. The parameters that are sent indicate which of the
overloaded methods to use.

23. List the four categories into which classes fall.

Classes are entity, boundary (or interface), control, or abstract.

24. What are the two categories of relationships between classes?

The two categories of relationships between classes are associations and


whole/part relationships.
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-26

25. What are gen/spec diagrams used for?

Gen/spec diagrams are used to show general classes and the specialized
classes that inherits the attributes and methods from the general class.
Chapter 18 Systems Analysis and Design Instructor's Manual 18-27

26. What is another term for polymorphism?

Polymorphism, or method overriding, is when the specialized classes have


a version of the same method contained in the general class. The subclass
may add to or modify the method.

27. What is depicted by a statechart diagram?

A statechart diagram depicts the states that an object may have and the
events that cause the object to transition to a different state.

28. What is a package in UML approach?

A package is a container for other UML things, such as use cases or


classes. They show partitioning, or which classes are grouped into a
subsystem.

29. Why is using UML for modeling important?

Using UML for modeling is important because it helps to achieve a greater


understanding between the business team and the IT team regarding the
requirements and processes of a system. It provides a detailed set of
specifications for the classes, scenarios, activities and sequencing in the
system. It helps to implement changes earlier in the project, when it is
easier and less costly to make changes.

Problems

1. Create a series of CRC cards for World’s Trend Catalog Division. Once an
order is placed, the order fulfillment crew takes over and checks for
availability, fills the order, and calculates the total amount of the order. Use
five CRC cards, one for each of the following classes: order, order
fulfillment, inventory, product, and customer. Complete the section on
classes, responsibilities, and collaborators.
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-28

Class Name: Order


Superclasses:
Subclasses:
Responsibilities Collaborators
Check order for available items OrderLine
Determine payment OrderLine
Check for a payment Customer
Dispatch to delivery address

Class Name: OrderFulfillment


Superclasses:
Subclasses:
Responsibilities Collaborators
Check for availability Inventory
Determine unit price and amount Product

Class Name: Inventory


Superclasses:
Subclasses:
Responsibilities Collaborators
Provide balance
Modify balance
Monitor balance

Class Name: Product


Superclasses:
Subclasses:
Responsibilities Collaborators
Provide unit price
Chapter 18 Systems Analysis and Design Instructor's Manual 18-29

Class Name: Customer


Superclasses:
Subclasses:
Responsibilities Collaborators
Make order Order
Pay order

2. Finish the CRC cards in Problem 1 by creating Object Think statements


and property names for each of the five classes.

Class Name: Order


Superclasses:
Subclasses:
Responsibilities Collaborato Object Think Property
rs
Check order for OrderLine I know which customer I CustomerID
available items belong to
I know when I occur Order Date
I know where I will be DeliveryAddr
delivered ess
Determine payment OrderLine I need to summarize the TotalAmount
total payment
Check for a payment Customer I know the payment PaymentMeth
method od
Dispatch to delivery I know the shipment ShipMethod
address method

Class Name: OrderFulfillment


Superclasses:
Subclasses:
Responsibilities Collaborato Object Think Property
rs
Check for availability Inventory I know which order I OrderID
belong to
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-30

I know my product identity ProdID


I know how many are Quantity
ordered
I need to check the Available
availability
Determine unit price Product I know the date I occur RentalDate
and amount

Class Name: Inventory


Superclasses:
Subclasses:
Responsibilities Collaborato Object Think Property
rs
Provide balance I know my product identity ProdID
Modify balance I know my current balance Balance
Monitor balance I know my limit Limit

Class Name: Product


Superclasses:
Subclasses:
Responsibilities Collaborato Object Think Property
rs
Provide unit price I know my identity ProdID
I know my unit price UnitPrice

Class Name: Customer


Superclasses:
Subclasses:
Responsibilities Collaborato Object Think Property
rs
Make order Order I know my name, phone, Name, Phone,
address Address
I know my identity CustomerID
Chapter 18 Systems Analysis and Design Instructor's Manual 18-31

Pay order I know my payment PaymentDue


balance due

Check Status

Place Order Salesperson

Customer
File Orders

Shipping Clerk

Establish Credit

Credit Manager

3. Draw a use case diagram for World’s Trend Catalog Division.


Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-32

4. For the FilmMagic problem in Consulting Opportunity 18.1, draw a class


diagram in UML.
Chapter 18 Systems Analysis and Design Instructor's Manual 18-33

5. For the FilmMagic problem in Consulting Opportunity 18.1, draw statechart


diagrams for (a) Customer and (b) Video.

Added In

Available for rent


(LateFeeDue = 0) Rented

Need to pay before rent


(LateFeeDue <> 0) Deleted

Deleted
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-34

6. Draw four pictures showing examples of four types of behavioral


relationships for Joel Porter’s BMW automobile dealership. What type of
relationship is involved when a customer must arrange financing? Are there
common activities involved when a person either leases or buys an
automobile? What type of relationship is between an employee that is a
manager or one that is a salesperson?

The extend relationship that is involved when a customer must arrange


financing.

The common activities would be paying cash or arranging a loan. Another


common activity would be transfer of title.

Sell Automobile

Salesperson

Pay Cash
«include»

Complete
Transaction

«include»
Arrange Loan

is a

Head Salesperson Salesperson

trade in price, amount financed,


monthly payment
Arrange
Sell Automobile Financing
«extend»

The relationship between an employee that is a manager or one that is a


salesperson is general, assuming that a manager may also be a
salesperson.
Chapter 18 Systems Analysis and Design Instructor's Manual 18-35

7. Draw a communication diagram for a student taking a course from a


teacher, who is part of the faculty.

tutor 1 student *
Teacher::Person Student::Person

faculty member * lecturer 1 participant *

faculty 1 given course *


taken course *

::Faculty ::Course
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-36

8. Coleman County has a phone exchange that handles calls between callers
and those receiving the call. Given these three actors, draw a simple sequence
diagram for making a simple phone call.
Chapter 18 Systems Analysis and Design Instructor's Manual 18-37

9. You are ready to begin the UML modeling for the Kirt Clinic. Draw a class
diagram that includes a physician, a patient, an appointment, and a patient’s
bill. Do not get the insurance company involved.
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-38

10. Use the UML to draw examples of the four structural relationships for the
Kirt Clinic.

Employee

a kind
of

a kind of a kind of

Administrative
Doctor Nurse Personnel

Health Team

a part of a part of

a part
of

Administrative
Doctor Nurse Personnel

11. Write a sample use case scenario for a patient who sees a physician in the
Kirt Clinic.

A patient may make any number of appointments. Each appointment is


made for a specific date and time with a physician. The patient may cancel
without notice. If the appointment is not canceled it leads to a bill. Each
bill has a specific amount due. If the appointment is canceled, a
cancellation fee is generated. A patient may change their status. Their last
visit is calculated.

12. Woody’s Supermarket, a small chain of grocery stores, is building a Web


site to allow customers to place orders for groceries and other items they
sell. The customer places a Web order, the customer master is updated,
and an order record created. The order prints at a local store, and the
goods are picked from the shelves by the store employees. Customers are
sent an email notification that their order is ready. When they pick up the
order, frozen goods, chilled products, and other items are assembled. Draw
Chapter 18 Systems Analysis and Design Instructor's Manual 18-39

an activity diagram showing the customer using the Web site to place an
order, verification of the order, order confirmation, order details sent to the
local store, and a customer email sent to the customer.

The activity diagram is shown on the next page.


Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-40

13. Sludge’s Auto was introduced in Chapter 12 as an auto parts recycling


center, using Ajax on Web sites for customers to browse for parts. The
customer needs to know the make, model, and year of a car as well as the
part. If the part is in stock, the description, condition of the part, price, and
shipping cost are displayed, with the quantity available for each condition
of the part, along with a picture of the part. Draw a sequence diagram using
boundary, control, and entity classes for the Auto Part Query for Sludge’s
Auto.

The sequence diagram is shown on the next page.


Chapter 18 Systems Analysis and Design Instructor's Manual 18-41

14. Musixscore.com is an online service providing sheet music to customers.


On the “browse music” Web page, customers select a genre of music from
a dropdown list. The Web page uses Ajax to obtain a list of performers,
musicians, or groups that match the genre, which is formatted as a drop-
down list. When a selection is made from the performers drop-down list,
the Web page uses Ajax to display a third drop-down list displaying all of
the CDs or other works of the performer. When a CD is selected, the Web
page uses Ajax to obtain all the songs on the CD in a fourth drop-down list.
The viewer may make multiple selections. When the Add To Shopping Cart
image is clicked, the songs are added to the shopping cart. The viewer may
change any of the drop-down lists to select additional sheet music, and the
process is repeated.
a. Write a use case description for the Browse Music Score use case,
representing this activity.
b. Draw a sequence diagram using boundary, control, and entity classes
for the Musixscore Web page.
c. Write a list of the messages, names and the parameters, along with the
data types, that would be passed to the classes and the values (with data
types) that are included with the return message. Make any assumptions
you need about the data.
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-42

d. Create a class diagram for the entity classes used in the sequence
diagram.

a. The use case description is on the next page.


Chapter 18 Systems Analysis and Design Instructor's Manual 18-43

Use case name: Browse Music Unique ID: MS021


Area: Sales
Actor(s): Customer
Description: Use selection lists to sell music over the Web
Triggering Event: Customer opens Web page
Trigger Type:  External  Internal
Steps Performed (Main Path) Information for Steps
1. Server loads a list of all genres 1. Genre database table
2. Customer selects a genre 2. Genre option list
3. Display an updated list of 3. Performer database table
performers for selected genre
4. Customer selects a performer 4. Performer option list
5. Display an updated list of items 5. Performer Items database table
produced by performer
6. Customer selects an item 6. Item option list
7. Display an updated list of all 7. CD Song database table
songs for item 8. Song selection list
8. Customer selects a song 9. Shopping Cart database table
9. Update shopping cart 10. Updated total from shopping cart
10. Updated total is displayed on
Web page
Preconditions: User is logged on
Postconditions: Music has been placed in the shopping cart by the
customer
Assumptions: Browser is a newer version, capable of supporting Ajax
Objectives Met: Allow customer to select songs to place in the shopping cart
Outstanding Issues: How to handle the situation that customer does not have an
Ajax capable browser.
Priority (optional): High
Risk (optional): Moderate

b. The sequence diagram is shown on the next page.


Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-44
Chapter 18 Systems Analysis and Design Instructor's Manual 18-45

c. The messages are summarized in the table below.

Message or Return Parameter Data Type


Name
getGenre() None
return genreList Multiple Genre Number integer
Multiple Genre Name string
selectGenre() Genre Number integer
findPerformer() Genre Number integer
return performerlList Multiple Performer integer
Number string
Multiple Performer Name
getPerformer() Performer Number integer
selectPerformerItems( Performer Number integer
)
return Item Number integer
performerItemList Item Description string
Item Cost decimal
selectedItem() Item Number integer
selectSong() Item Number integer
return songList Multiple Song Number integer
Multiple Song Title string
Multiple Song Playing decimal
Time decimal
Multiple Song Cost
selectSong() Song Number integer
selectSong() Song Number integer
return Total decimal
shopptinCartTotal
update Total Total decimal
Chapter 18 Object-Oriented Systems Analysis and Design Using UML 18-46

d. The class diagram is shown below.

S-ar putea să vă placă și