Object Oriented and Analysis with UML (part 5)

Objective: Dynamic Modeling

You are developing an application that will have multiple threads of execution. You need to properly show these threads of execution in a process model.

Which one of the following diagrams would best demonstrate the use of threads?

Collaboration
Class
Activity
Interaction

Answer Explanation: An activity diagram can be used to understand a workflow, analyze a use case, describe a complicated sequential algorithm, and deal with multi-threaded applications. An activity state is shown in an activity diagram by a box with rounded corners containing a description of the activity. With activity diagrams, you can specify the order of activities, state sequencing rules, and capture sequential and parallel activities.

The option “Collaboration” is incorrect. A collaboration diagram is a type of interaction diagram that shows objects as icons. The sequence is shown by incrementing numbers, which may or may not have a decimal numbering scheme. This type of diagram would not be best to demonstrate the use of threads. It would be better if the activity diagram shows threads of execution in a process model.

The option “Class” is incorrect. A class diagram describes the objects in the system and the relationships that may exist between these objects. This type of diagram would not be best to demonstrate the use of threads.

The option “Interaction” is incorrect. An interaction diagram shows how groups of objects collaborate with one another. A typical interaction diagram models a single use case. It is not the best diagram to demonstrate thread use.

==================================================================================

Which diagram displays the use of an association class?

Answer Explanation: An association class is used to model an association that has attributes. The class portion and the association portion are treated as one element. It is modeled with a dotted line running from the class portion to the association line.

The “b” option is incorrect. This is an example of self association.

The “c” option is incorrect. This is an example of a qualified association.

The “d” option is incorrect. This is an example of binary association.

=================================================================================
You are designing an application to order items in cases. The application must ensure that the case is full before the case is closed and moved down the orderline. You create a state diagram that will take a case and fill the case. Once the case is filled, a message will be sent and the case can move down the order line to shipping. You develop the state diagram

Which of the following methods is the best way to implement a superstate that will abort the process of the order and place the order in a cancelled state?

Encompass the Check case and Waiting states in a bounding box to represent that only these two states can cancel the order.
Encompass the Check case, Waiting, and Order delivery states in a bounding box to represent that these three states can cancel the order.
Encompass the Check case state in a bounding box to represent that only this state can cancel the order.
Encompass the Check case, Order delivery, and Order delivery states in a bounding box to represent that only these three states can cancel the order.

Answer Explanation: Superstates act like a catch-all state, where many possible states could result in the same state; in this case, the Cancel state is a superstate. A user could cancel their transaction at anytime, such as when the case is being checked, when some of the items to fill the case are not in stock, or before the order is dispatched and delivered. After the order is delivered, the user will not be able to cancel their order. The superstate is shown in the following diagram

The option “Encompass the Check case and Waiting states in a bounding box to represent that only these two states can cancel the order” is incorrect. These are not all of the possible states that the user could cancel their order. The bounding superstate needs to encompass the Check case, Waiting, and Order delivery state, since these are all possible states where the user could cancel their order.

The option “Encompass the Check case state in a bounding box to represent that only this state can cancel the order” is incorrect. This is not the only possible state where the user could possibly cancel their order. A user could also cancel the transaction during the Waiting and Order delivery states.

The option “Encompass the Check case, Order delivery, and Order delivery states in a bounding box to represent that only these three states can cancel the order” is incorrect. These are not all of the possible states where the user could possibly cancel their order. A user could also cancel the transaction during the Waiting state.

=================================================================================

Objective: Dynamic Modeling

When you define classes, you need to ensure that the class has a definite responsibility. A class’ responsibility is a contract or obligation of a type or class. The behavior of an object relates the class’ responsibility to the object obligation.

What types of responsibilities can an object have?

Knowing
Learning
Making
Doing

Answer Explanation: Responsibilities of a class are defined as a contract or obligation. The responsibilities of an object are broken down into what the class knows and what the class does. The doing responsibilities of an object include when the object does something for itself, when the object initiates an action in another object, and when the object controls and coordinates activities in other objects. The knowing responsibilities of an object include the private encapsulated data, related objects, and the items that can be derived or calculated from the object.

The option “Making” is incorrect. This is a fictitious term in relation to the types of responsibilities that an object can have.

The option “Learning” is incorrect. This is term is fictitious in relation to the types of object responsibilities.

==================================================================================

Objective: Development Process

You are organizing development teams for a new project. In this project team, there are many developers and the OOAD artifacts all have been identified.

Which one of the following will utilize the OOAD artifacts to manage your project team? (Choose the best answer)

Divide your project team into small teams and assign the use cases on a team basis.
Divide your teams according to the packages and assign ownership of each use case to individual developers. Schedule efforts by use case, with multiple developers working on each use case as needed.
Divide your teams according to the use cases and assign ownership of the packages to individual developers as needed.
Divide your teams along the software architecture layers and assign use cases according to the software architecture layers.

Answer Explanation: You are able to use OOAD artifacts to manage your project teams by dividing your teams according to the packages, assigning ownership of each use case to individual developers, and scheduling the development efforts by use case. Developers should be assigned on each use case as needed. Packages are used to organize components into groups. Packages have no behavior, but they facilitate the organization and management of the system under development.

The option “Divide your project team into small teams and assign the use cases on a team basis” is incorrect. When you create your teams, you will need to use a mechanism that will properly distribute the workload among your project team. This can be accomplished by dividing your teams according to packages.

The option “Divide your teams according to the use cases, and assign ownership of the packages to individual developers as needed” is incorrect. Dividing your development teams by use case is not a good project design philosophy.

The option “Divide your teams along the software architecture layers and assign use cases according to the software architecture layers” is incorrect. Dividing your development teams by the software architecture layers is not a good project design formula.

=================================================================================

Which of the following situations would warrant a new class? (Choose two)

You discover that there are two classes that provide the same functionality.
There is one class in your system that has most of the responsibility.
You have a class with several public attributes.
You discover a new class when expanding a use case.

Answer Explanation: When a class has considerably more responsibility than any other class in your system, it is usually best to create a new class and divide functionality between them.

Although you can usually find most of the main classes in the initial analysis of the system requirements, you will undoubtedly find new classes as you run through new iterations and expand functionality.

The “You discover that there are two classes that provide the same functionality” option is incorrect. In this situation it is usually best to remove one of the classes and ensure that the remaining class implements the functionality required.

The “You have a class with several public attributes” option is incorrect. Public attributes in classes should be avoided when possible but do not require a new class.

=================================================================================

Objective: Dynamic Modeling

Activity diagrams can be used in conjunction with use-cases to model a path of execution throughout the system. Activity diagrams show what happens in the system, as well as conditionals that affect the execution order.

What is the best way to show a conditional statement in an activity diagram?

A square along a path in the activity diagram
A triangle along a path in the activity diagram
A diamond along a path in the activity diagram
A circle along a path in the activity diagram

Answer Explanation: To alter the execution path in an activity diagram, you can use a conditional. A conditional is represented by a diamond shape along a path in your activity diagram. These shapes represent conditions; for example, if a stock of a certain item is below a certain number, then a reorder stock use case will fire to replenish the stock level. Conditionals and actions are the main parts of an activity diagram. They help define an activity diagram.

The option “A square along a path in the activity diagram” is incorrect. A square has no significance in an activity diagram. The best way to show a conditional along a path in an activity diagram is by using a diamond.

The option “A triangle along a path in the activity diagram” is incorrect. A triangle has no significance in an activity diagram. A diamond is the best method to show a conditional along a path in an activity diagram.

The option “A circle along a path in the activity diagram” is incorrect. A circle has no significance in an activity diagram.

=================================================================================

Objective: Dynamic Modeling

When you initially design your system, which type of diagram is best used to illustrate the transitions of a single object in response to relevant events?

Use-case diagrams
State diagrams
Collaboration diagrams
Interaction diagrams

Answer Explanation: State diagrams are used to describe the behavior of the system. A state diagram can describe all possible states that an object may encounter during its lifetime and can illustrate how the object will react to events. State diagrams may also show the lifetime of a single class instance. They are well designed to show the behavior of an object across multiple use cases.

The option “Use-case diagrams” is incorrect. Use-case diagrams are used to visualize use-cases. Use-case diagrams do not determine the different states an object can have during its lifetime. This is best handled by a state diagram.

The option “Collaboration diagrams” is incorrect. A collaboration diagram is a type of interaction diagram. It uses numbers to show the sequence of events. Collaboration diagrams do not determine the different states an object can have during its lifetime.

The option “Interaction diagrams” is incorrect. Interaction diagrams describe how groups of objects work together; they do not determine the different states an object can have during its lifetime.

=================================================================================

You are designing a collaboration diagram that shows two messages being sent simultaneously from ClassA to ClassB.

Which of the following diagrams BEST illustrates these two messages between ClassA and ClassB?

Answer: A

Answer Explanation: Interaction diagrams are used to illustrate the interaction of messages between two or more instances (and classes) in the class model. These interactions commence after the fulfillment of post-conditions of the operations contracts. UML defines two types of interaction diagrams, which are collaboration diagrams and sequence diagrams. To show sequential interaction in a collaboration diagram, you would use syntax as illustrated in the image labeled A. In this diagram, first a message is sent to ClassA, which causes two messages to be sent to ClassB. In collaboration diagrams, the name of the class is indicated with a colon (:) before the name of the class.

The “B” option is incorrect. To show sequential interaction in a collaboration diagram, you would use the syntax that is illustrated in the image labeled A. In collaboration diagrams, the name of the class is indicated with a colon (:) before the name of the class; however, the arrow on MessageThree is pointing in the wrong direction.

The “C” option is incorrect. To show sequential interaction in a collaboration diagram, you would use the syntax illustrated in the image labeled A. In collaboration diagrams, the name of the class is indicated with a colon (:) before the name of the class. Since the colon is after the name of the class, this option does not have the correct syntax.

The “D” option is incorrect. To show sequential interaction in a collaboration diagram, you would use the syntax illustrated in the image labeled A. In collaboration diagrams, the name of the class is indicated with a colon (:) before the name of the class. This option does not provide the correct syntax, since the colon is after the name of the class.

==================================================================================

Objective: Static Modeling

Which of the following situations is the best example of polymorphism?

You have modeled an Animal class with three subclasses of Mammal, Bird, and Reptile.
You have modeled a Car class with composition relationships to Wheel and Engine classes.
You have modeled an object to pass a message to another object and get a message back in return.
Two classes are associated to one another through an association class.

Answer Explanation: Polymorphism can be realized through inheritance or through interface implementation. In this example, an object of the Animal class can take on any of the subclass forms and implement the behavior of that subclass, thus making it polymorphic.

The “You have modeled a Car class with composition relationships to Wheel and Engine classes” option is incorrect. A composition relationship is not an example of polymorphism.

The “You have modeled an object to pass a message to another object and get a message back in return” option is incorrect. This is an example of delegation.

The “Two classes are associated to one another through an association class” option is incorrect. Association classes are not examples of polymorphism.

=================================================================================

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: