Object Oriented and Analysis with UML (part 4)

You are designing an application that will have multiple tiers. The presentation layer will contain the client interface. You are now deciding where to place the business logic in order to gain the most in performance from your application.

Where is the best place to put business logic in order to have the best scalability with your application?

Place the business logic with the presentation logic for your application
Place the business logic in a separate layer from your presentation and storage layers
Place the business logic in the storage layer of your application model
Place the business logic in the presentation layer and the storage layer for maximum speed when enforcing business rules

Answer Explanation: A classic architecture for a system that involves a user interface, storage medium, and business rules is better known as a three-tiered application. Designing an application with separate layers can benefit your application’s scalability. If the business rules change within your organization, you will only need to modify the business rules layer and not the presentation or the storage layers.

All other options do not represent the best way to implement the application’s layers.

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

When writing use cases, what should designers concentrate on?

How many users will interact with the system
Object reuse
The sequence in which events will happen once a user makes a request
The services that the system should provide

Answer Explanation: The purpose of developing use cases is to define the required services or behavior of a system without including implementation details. It is one of the first steps in designing a software solution.

The “How many users will interact with the system” option is incorrect. Since implementation details are left out of use cases entirely, the number of users should not be a consideration when creating them.

The “Object reuse” option is incorrect. Use cases do not contain details about objects or classes of the system. Also, since use cases are one of the first steps in iterative development, they are normally documented before any classes exist in documentation.

The “The sequence in which multiple processes will happen once a user makes a request” option is incorrect. This type of multithreaded behavior may be more appropriately illustrated in an activity diagram.

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

You are evaluating a project and need to determine the most appropriate OOAD artifact for a UML diagram that spans multiple use cases.

Which of the following are best for this scenario? (Choose two)

State diagram
Interaction diagram
Activity diagram
Deployment diagram

Answer Explanation: Both state and activity diagrams are UML diagrams that span multiple use cases. A state diagram is used to show how a single object will behave across multiple use cases. State diagrams are used with state dependant objects with complex behavior. An activity diagram shows the behavior of objects with control structure. Activity diagrams can show many objects over multiple use cases, many objects in a single use case, or the implementation of a method.

The option “Interaction diagram” is incorrect. Interaction diagrams are used to model the dynamic behavior of the system, and do not show OOAD artifacts that span multiple use cases.

The option “Deployment diagram” is incorrect. A deployment diagram shows the physical layout of components on hardware nodes, and does not show OOAD artifacts that span multiple use cases.

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

Objective: Static Modeling

When designing a new system, the development team realizes that another class residing in a different package needs access to a class’ private attribute.

Which is the BEST way to implement this functionality?

Change the attribute to be public and reference it from the outside class.
Change the attribute to be protected and reference it from the outside class.
Leave the attribute as private and create getter and setter methods for accessing it.
Nothing. The class should be able to access the attribute.

// <![CDATA[// <![CDATA[
if(navigator.appName.indexOf("Microsoft") != -1){
if(document.all){ //Not for IE4 or IE5.0
if(navigator.userAgent.indexOf('MSIE 4.') <0 && navigator.userAgent.indexOf('MSIE 5.0')

Answer Explanation: Wherever possible, it is best to have private attributes and getter and setter methods for access in order to maintain encapsulation.

The “Change the attribute to be public and reference it from the outside class” option is incorrect. It is never a good idea to have public attributes if they can be avoided. Public attributes break encapsulation rules.

The “Change the attribute to be protected and reference it from the outside class” option is incorrect. Protected attributes can only be accessed from outside the package in which the class with the protected attribute resides if it is a subclass of that class.

The “Nothing. The class should be able to access the attribute.” option is incorrect. Private attributes can only be accessed by the owning class.

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

Objective: Dynamic Modeling

You are designing a banking application that will be responsible for money transfers between customers’ bank accounts. You are deciding on names for actions that will be in your UML state diagrams. You have the following interview with the bank manager.

Bank Manager – “We need a system that will allow money transfers between our customer’s accounts. As well, the program needs to have the ability to handle deposits and withdrawals.”

What terminology can you use to describe the actions of the UML state diagram?

Money, accounts, and bank manager
Transfer, deposit, and withdraw
Transfer, accounts, and bank manager
Money, accounts, and withdraw

Answer Explanation: Actions occur in response to an event. If you are designing a banking application to be responsible for customer transactions, you can determine what actions an object will have by modeling the application. Actions the user can take on your application would be to deposit, transfer, and withdraw money into or from their bank accounts.

The option “Money, accounts, bank manager” is incorrect. Money and bank manager would not be used to name states in a state diagram.

The option “Transfer, accounts, and bank manager” is incorrect. Bank manager and accounts would not be used to name states in a state diagram.

The option “Money, accounts, and withdraw” is incorrect. Money and accounts would not be used to name states in a state diagram.

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

Objective: Dynamic Modeling

You are designing an object-oriented application. You wish to use diagrams and use case scenarios to identify the required details in your OO application.

Of the following options, which tools are used properly to indicate required details? (Choose two)

Use class diagrams to show navigability of associations.
Show multiple use case scenarios together on the same interaction diagram.
Show any asynchronous messages in interaction diagrams.
Ensure that message sequence numbers are used in collaboration diagrams.

Answer Explanation: Interaction diagrams show how objects collaborate in some behavior. An interaction diagram typically captures a single use case and shows the interaction between the objects that are in the use case. These interactions within the use case can show asynchronous messages. In collaboration diagrams, you can show important objects and links within an interaction. A sequence of numbers is used in collaboration diagrams, attached to the front of message descriptions.

The option “Use class diagrams to show navigability of associations” is incorrect. Class diagrams can include associations and relations to inheritance (generalization) of all relationships between concepts. Class diagrams shows the operations of the classes; however, it does not show navigability of associations as these are better expressed in other diagrams, such as state or collaboration diagrams.

The option “Show multiple use case scenarios together on the same interaction diagram” is incorrect. An interaction diagram shows object interactions. These include collaboration and sequence diagrams. An interaction diagram captures the behavior of a single use case.

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

Objective: Static Modeling

True or false? In the domain model, a class diagram shows the classes and relationships of software components.

True
False

Answer Explanation: A class diagram in the domain model is a representation of real world classes, not software classes.

The “True” option is incorrect. The design model is where a class diagram includes software classes.

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

Objective: Design and Implementation Techniques

When should you use global variables in your application?

Use global variables with each function.
Set global variables, even if the variables serve no purpose.
Limit global variables in applications.
Global variables are not supported in an object-oriented system.

Answer Explanation: Global variables should be used sparingly in your applications. They can be modified anywhere in the application, which can cause unpredictable results. In the event that a global variable causes a failure, it can be difficult to establish where the variable was modified, resulting in the erroneous value or code. Because of this reason, you need to limit the use of global variables in applications.

The option “Use global variables with each function” is incorrect. If each function used or created global variables for no reason, this would result in significant use of memory.

The option “Set global variables, even if the variables serve no purpose” is incorrect. Every variable you use in your application should serve a specific purpose.

The option “Global variables are not supported in an object-oriented system” is incorrect. Object-oriented systems do support the use of global variables.

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

Objective: Dynamic Modeling

You are designing a project for a banking application. You are creating interaction diagrams to help you realize use cases that exist in your project.

Which of the following are types of interaction diagrams that will help you realize interactions between objects? (Choose all that apply)

Class diagram
Sequence diagram
Collaboration diagram
Class

Answer Explanation: The two types of interaction diagrams are sequence diagrams and collaboration diagrams. Sequence diagrams show object interactions arranged over a time sequence. A collaboration diagram shows object interaction organized around objects and displays their relationships to one another.

The option “Class diagram” is incorrect. A class diagram is a description of objects and object relationships. The class diagram is a core of object-oriented development. A class diagram will not help you realize interactions between objects.

The option “Class” is incorrect. A class is a set of common objects. These objects share similar structure, and common behavior, relationships, and semantics. Classes will not help you realize interactions between objects.

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

Objective: Static Modeling

When investigating requirements documents for potential services, it is best to concentrate on:

Verbs within the text
Nouns within the text
Actors that initiate use cases
Dependencies between classes

Answer Explanation: Verbs in the requirements document would signify potential services required of the system. Phrases such as “buys a product”, “moves a car”, and “logs a transaction” would all be good indicators of services that need to exist in the system.

The “Nouns within the text” option is incorrect. Nouns are indicators of the classes or objects that the system will require. They do not indicate services.

The “Actors that initiate use cases” option is incorrect. Actors are essentially roles that initiate events within the system. They take advantage of the services but do not indicate the services that will be required.

The “Dependencies between classes” option is incorrect. Dependencies between classes give no indication of the services required of the system. Also, at the requirements document analysis stage it is unlikely that potential classes are even considered.

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

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: