Category Archives: Software Engineering

Findbugs, PMD and CheckStyle

Findbugs, PMD and CheckStyle – These are static code analysis tools which are widely used in JAVA development. Each of them is mainly targeting a certain type of coding rules : Checkstyle for “conventions”, PMD for “bad practices” and Findbugs for “potential bugs”.

Findbugs

– finds bugs in JAVA byte code. It finds the real defects. It is very fast because of byte code. It helps us to detect what is not clearly visible in the code and understand why sequences of code leads to potential bugs. Example: Synchronization and Boolean could lead to deadlock.

Findbugs is a kind of analyst for our source code.

PMD

– looks for potential problems, possible bugs, unused and sub-optimal code and over-complicated expressions in the Java source code. Bad practices type consists of well known behaviors that almost systematically lead to difficulties over time.
Examples: too many complex methods, direct uses of implementation rather via interfaces and unwantedly catching exceptions.

PMD always looks over your shoulder to remind you of bad practices.

CheckStyle

– scans source code and looks for coding standards, e.g. the Sun Code Conventions, JavaDoc. It covers naming, comments and format conventions.

Examples: Is there javadoc on public methods?, Is the code written with a consistent format?

NOTE: This article is not completed, will come up with more soon… 🙂

Advertisements

Object Oriented Analysis and Design (Part 9)

Objective: Development Process
Which of the following statements are true concerning incremental processes? (Choose all that apply)

When developing an application, you must keep incremental and iterative development separate.
When developing an application, you use incremental development as a divide-and-conquer approach.
When developing an application, multiple teams can work in parallel with concurrent development by taking a part of the application.
When developing an application, you can model increments with activity diagrams.
Answer Explanation: Incremental development involves the development of a model and other artifacts of an application in a series of versions. These versions are each operational on their own to some degree, but each add incremental detail to the previous version. Each version of the product can be debugged and evaluated based on changes from the previous version, keeping changes small, and keeping track of all changes. Incremental development is closely related to iterative development. Incremental and iterative life cycles are architectural releases that evolve into the final system.

The option “When developing an application, you must keep incremental and iterative development separate” is incorrect. In fact, incremental and iterative development is closely allied. Incremental development can be used to break up a project into smaller, more manageable pieces. This is done by having multiple teams work in parallel with concurrent development, with each team taking an increment or a part of an application.

The option “When developing an application, you can model increments with activity diagrams” is incorrect. Activity diagrams are used to show an activity graph, not to model increments.

=================================================================================
Objective: Architecture
You are designing a database application that will hold banking information for InterSwift. InterSwift has many clients that have a high volume of concurrent requests. Some of the requests, especially the requests that involve accessing banking information, are highly important and need to be accomplished in one atomic action.

Which of the following should be considered? (Choose all that apply)

Disable auto-commit and leverage the DBMS’ transaction facilities
Install both the client and server portions of your application on the client machines for quicker access times
Install both the client and server portions of your application on the server machine for quicker access times
Use a three-tiered system to facilitate the scalability of the system
Answer Explanation: Since this particular database will be holding banking information and the transactions need to be in an atomic transaction, disabling the auto-commit in order to use the DBMS’ transaction facilities will prevent the need of writing additional code for this feature. Using a three-tiered design can increase the scalability of your system, since each part of the system is separate. If you needed to replace business rules on the business logic layer, you can do so without affecting the presentation or the storage layers.

The options that recommend installing the client and server portions of the application on the server or client machines are incorrect. They are unnecessary steps that would consume additional disk space.

=================================================================================
Objective: Requirements Modeling
Your company is hired to develop a new system for a small clothing store that is very cost-conscious. Which is the BEST approach to take to minimize time and, in effect, cost to the company during development?

Schedule a requirements meeting with the manager and list as many of the requirements specifications as possible. Select the highest risk requirements from the list to develop into use cases. Expand on these high-risk use cases and use this documentation to develop most of the system.
Develop prototypes for the main functionality and interfaces of the system and review with employees to obtain immediate feedback. Use this feedback to get an idea of changes and expansion required.
Skip most of the use case process in order to develop an elaborate class diagram. Use this class diagram to help illustrate the dependencies within the system to the end users of the application.
Concentrate on developing all required use cases and as many interaction diagrams as possible so the development can be accomplished in one iteration.
Answer Explanation: When under budget or time restraints, prototypes can greatly speed up the development process. They allow you to gain immediate feedback from the domain users that will be accessing the system every day.

The option that begins with “Schedule a requirements meeting with the manager . . . .” is incorrect. Although the manager will most likely be the end decision maker on needed functionality of the system, employees usually prove to be a better resource for extracting requirements. Also, it is not a good idea to develop most of the system without reviewing it with the domain experts.

The option that begins with “Skip most of the use case process in order to develop an elaborate class diagram . . . .” is incorrect. Use cases are nearly essential in extracting system requirements. Use cases also provide excellent documentation for discovering possible classes. Not performing this step will normally prove more time consuming and costly in the end. Also, end users of the system do not normally need to know the dependencies within the system.

The option that begins with “Concentrate on developing all required use cases and as many interaction diagrams as possible . . . .” is incorrect. Very rarely can a system be completed in one iteration. Most attempts to do so will result in an unsuccessful application.

==================================================================================
Objective: Design and Implementation Techniques
Patterns are design templates that offer useful bits of coding techniques, analysis, and design. GRASP (General Responsibility Assignment Software Pattern) describes the principles of responsibility assignment and fundamental principles of software development.

Which of the following patterns is used to create objects with special considerations?

Singleton pattern
Factory pattern
Adapter pattern
Strategy pattern
Answer Explanation: The Factory (GoF) pattern solves problems that deal with the responsibility of creating objects with special considerations, such as better cohesion and complex creation logic. GoF stands for Gang of Four. This acronym refers to the authors of the book, “Design Patterns: Elements of Reusable Object-Oriented Software”.

The option “Singleton pattern” is incorrect. A singleton pattern is a good solution to objects that need only a single, global point of access. A factory (GoF) pattern creates objects with special considerations, such as better cohesion and complex creation logic.

The option “Adapter pattern” is incorrect. An adapter (GoF) pattern creates a common interface that will be used among similar components with different interfaces.

The option “Strategy pattern” is incorrect. A strategy (GoF) pattern determines how to design for similar, but varying, algorithms or policies.

=================================================================================
Objective: Development Process
Object-oriented Analysis and Design (OOAD) is an iterative process that is used to identify objects and classes. You should begin this process by analyzing use cases.

Which of the following are phases in the iterative process? (Choose all that apply)

Transition phase
Inception phase
Elaboration phase
Construction phase
Answer Explanation: The iterative process consists of an inception phase, an elaboration phase, a construction phase, and a transition phase. Inception involves the vision of the product and the project scope. This phase also involves identifying the initial set of use cases, building the business cases, evaluating costs, risks, and developing the project plan for future iterations and phases of the project.

The elaboration phase is designed to prove the project’s technical and financial feasibility. The candidate architecture is explored and the usability is tested through a prototype that exercises the most technical and challenging aspects of the application. Reliability, response, and other non-functional requirements are specified at this time. Use cases are created for most of the functional requirements identified at the inception phase. Resource costs, such as personnel and schedules, are added to the project phase for future phases. Risks are reduced by being identified. The main outcome of this stage is the creation of an architectural baseline and the end of this phase signifies the Life-Cycle Architecture Milestone (LCA).

Design and implementations are part of the construction phase. Coding is performed to bring the concepts conceived during the inception phase and elaboration phase into reality. This phase results in the release of Beta products and the Initial Operation Capability (IOC) milestone.

Transition involves preparing the final product for release to the users. This phase includes final tuning of the application, correcting defects, preparing documentation, and training. Quality of the product is the main focus. The end of this phase results in the Product Release Milestone, once the product has been delivered to the customer.

==================================================================================
Objective: Dynamic Modeling
You observe a co-worker’s activity diagram for a new project that you were appointed to review. In the diagram there are multiplicity asterisks (*) between activities.

What does the multiplicity operator represent in an activity diagram?

Conditionals
Decisions
Iterations
Incremental
Answer Explanation: Activities are symbolized as rectangles with rounded corners. Each activity represents a task that needs to be done, such as a Fill order to complete an order for an inventory. Activities can be sequenced when one activity leads to the next. Activities have triggers to determine if, or how many times, each activity will occur. To show that an activity has several iterations, the multiplicity operator (*) is used.

The option “Conditionals” is incorrect. Conditionals are actually represented by a diamond shape in an activity diagram. Iterations are shown using the multiplicity operator (*).

The option “Decisions” is incorrect. This is a fictitious term in relation to an activity diagram.

The option “Incremental” is incorrect. Incremental normally refers to incremental development, which is the process of adding functionality to a system in a series of versions.

=================================================================================
Objective: Static Modeling
Which of the following is the BEST list of rules to use when naming classes?

Must be significant to the domain, short, and be a verb
Must be significant to the domain, a qualification of its superclass’ name, and a noun
Must be significant to the development team, start with an upper case letter, and be a noun
Must be significant to the development team, easy to remember, and be a verb
Answer Explanation: When naming classes it is better to use terms based on the domain than it is to use developer oriented terms. If a class has a superclass, the name should be a qualification of the superclass’ name. Class names should also be nouns since they represent objects or ideas within a system.

The “Must be significant to the domain, short, and be a verb” option is incorrect. Verbs are not normally well suited to be class names. They are best used as method names since they describe actions.

The “Must be significant to the development team, start with an upper case letter, and be a noun” option is incorrect. A class name should be meaningful to the domain, not the development team. Different programming languages have different conventions regarding the capitalization of class names. The UML, however, does not specify a case convention.

The “Must be significant to the development team, easy to remember, and be a verb” option is incorrect. Class names need to be meaningful to the domain, not the developers. Also, class names should be nouns, not verbs.

==================================================================================
Objective: Static Modeling
Which of the following statements regarding stereotypes are true? (Choose all that apply)

Stereotypes are normally shown as text strings enclosed in guillemets (« »).
Stereotypes can be applied to both classes and relationships.
All stereotypes are user-defined elements.
Stereotypes can be used in class diagrams as well as use case diagrams.
Answer Explanation: The syntax for showing a stereotype in a UML diagram is «stereotype name». Classes and relationships in class diagrams can both have stereotypes applied to them. Some stereotypes you may see attached to classes are «actor», «interface», and «metaclass». Examples of relationship stereotypes are «call», «send», and «use». In addition to class diagrams, stereotypes can also be used in use case diagrams. Some of the stereotypes you may see in a use case diagram are «include» and «extend».

The “All stereotypes are user-defined elements” option is incorrect. There are some stereotypes that are predefined by the UML. Some examples of these are «association», «call», «create», «file», «global», and «type».

=================================================================================
Objective: Architecture
In a well designed three-tiered application, a presentation layer, application logic layer, and a storage layer will exist. The presentation layer is for the graphical user interface (GUI) elements that the end user will see. The application logic layer is used for tasks and rules that govern the process, and the storage layer is for a persistent storage area.

Of the following statements, which one best describes these layers and how they interrelate?

All layers know of each other.
The presentation layer knows the application logic layer and the storage layer, and the application logic layer knows the storage layer.
The presentation layer knows the application logic layer. The application logic layer knows the storage layer. The storage layer knows the application logic layer.
The presentation layer knows the storage layer, the application logic layer knows the presentation layer, and the storage layer knows the application logic layer.
Answer Explanation: One of the most common architectures for information systems are three tiered-architectures. One of best qualities of a three-tiered architecture is the separation of application logic into a distinct logical middle tier. This allows the presentation layer to be relatively free of application processing. The presentation tier forwards application processing tasks to the application logic layer, which then turns communicates information to the storage layer.

The option “All layers know of each other” is incorrect. Not all of the layers know of each other in a three-tiered architecture.

The option “The presentation layer knows the application logic layer and the storage layer, and the application logic layer knows the storage layer” is incorrect. This is not the proper synopsis to detail which layers are aware of each other.

The option “The presentation layer knows the storage layer, the application logic layer knows the presentation layer, and the storage layer knows the application logic layer” is incorrect. This is not the proper synopsis to detail which layers are aware of each other.

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

Object Oriented Analysis and Design (part 8)

Objective: Requirements Modeling

You are part of the development team that has just been hired to design the system for a small online music store. You are under time and budget constraints. After consulting with various employees, you have extracted the following requirements.

A customer will be able to create an account with the site if they do not already have one. To purchase a CD, customers will be able to browse the catalog or search for a particular CD. Once a customer selects a CD and payment type and commits their purchase, the system will log the transaction, adjust the inventory, and print a receipt. Once the transaction is logged, the system will send an email to the sales department, which then uses the system to fill the order.

Which is the BEST list of possible use cases?

Create account, buy CD, and fill order
Create account, buy CD, print receipt, and fill order
Create account, select CD, buy CD, print receipt, and fill order
Create account, browse catalog, search for CD, select CD, buy CD, log transaction, adjust inventory, print receipt, send email, and fill order
Answer Explanation: A use case is normally used to explain a process in its entirety, from beginning to end. It involves the complete sequence of events in the process, including alternate and error sequences. Use cases, especially initial use cases, normally illustrate high-level functionality based on business requirements that must be implemented in the system. Create account, buy CD, and fill order are all essential business processes.

All other options are incorrect. Procedures such as print receipt and log transaction are not very well suited to be separate use cases. Since actions such as these would contain some implementation details, which are not included in use cases, it is better to include them as a step in a larger use case.

=================================================================================
Objective: Design and Implementation Techniques
You are using a model of your application to generate code. The generated code directly reflects the model of your unfinished application, including associations between classes and the operations and attributes that make up the classes. When you are developing the application, you find it necessary to add classes, attributes, and operations to existing classes.

Which of the following terms updates your model with any changes that you may make during coding?

Reverse engineering
Reverse tripping
Round tripping
Round engineering
Answer Explanation: Round tripping engineering helps to keep your code synchronized with your model. If modifications are made during the coding process, you can reverse engineer your code to keep your model synchronized with your application code. Reverse engineering refers to creating models from existing components and applications.

The option “Reverse engineering” is incorrect. Reverse engineering refers to creating models from existing components or applications. Round tripping synchronizes your code with your model and vice versa.

The option “Reverse tripping” is incorrect. This is a fictitious term in relation to the UML.

The option “Round engineering” is incorrect. This is a fictitious term in relation to the UML.

=================================================================================
Which of the classes properly use stereotypes?
Answer: A, C, D
Answer Explanation: Stereotypes are a kind of model element, defined in the model itself. Stereotypes are used to classify elements and are normally shown in text between guillemets (« »).

The “b” option is incorrect. An element can have at most one stereotype.

==================================================================================
Objective: Static Modeling
Which of the following are true regarding interfaces? (Choose all that apply)

An interface can provide implementation for some of its methods, but not all.
Interfaces cannot have attributes.
Interfaces can have generalization relationships.
All operations in an interface have to be public.
Answer Explanation: An interface is a set of operations that make up the externally visible functionality of a class. Interfaces provide only the specification and do not include any implementation details. There can be no attributes specified in an interface. If attributes are required, an abstract class must be used instead. All operations of an interface are public. Since there is no inside implementation in an interface, there would be no purpose to restricting the visibility of the operations. Interfaces can extend other interfaces. A child interface inherits the operations of the parent interface and can also add operations of its own.

The “An interface can provide implementation for some of its methods, but not all” option is incorrect. An interface cannot provide an implementation for any of its operations. Only abstract classes can be used to accomplish this.

=================================================================================
Objective: Dynamic Modeling
You are creating models that are the result of various development phases within the iterative development process. The development process consists of the inception, elaboration, construction, and transition phases.

Which of the following best represents the correct order of the modeling stage?

Analysis, deployment, design, implementation
Analysis, design, implementation, deployment
Implementation, analysis, deployment, design
Design, analysis, deployment, implementation
Answer Explanation: The development processes have one or more iterations, represented by the modeling stage. The iterations contain model elements that are moved along a path of analysis, design, implementation, and deployment.

The option “Analysis, deployment, design, implementation” is incorrect. The deployment process is the final process within the modeling stage, making the suggested order in this option incorrect.

The option “Implementation, analysis, deployment, design” is incorrect. The analysis process is the first process within the modeling stage and the design process comes before the implementation process, making the suggested order presented in this option incorrect.

The option “Design, analysis, deployment, implementation” is incorrect. The analysis process is the first process within the modeling stage and the design process comes before the implementation process. Also, the deployment process is the final process, making the suggested order presented in this option incorrect.

=================================================================================
Objective: Static Modeling
While working on the first iteration of a project, you discover that a class you have created does not have an identity that is important to the system, in the context of your application, but still needs to be implemented in the system.

Which would be the most likely way to implement the class?

As an attribute of another class
As an interface
As a method of another class
As an abstract method of another class
Answer Explanation: Objects can be broken down into two basic categories: reference objects and value objects. Reference objects are objects such as customer or order. These types of objects will almost always need to be implemented as classes in a system to capture all the necessary functionality of that class. Value objects are objects like date, or destination, which may or may not need to be implemented as a class depending on the context in which they are used. Consider the destination object for example. If you are designing a system in which an airplane is a major part, destination may be best implemented as a separate airport class. On the other hand, if an airplane is a miniscule part of the application, implementing destination as an attribute of the airplane class may suffice.

The “As an interface” option is incorrect. An interface allows you to define the interface but defer its implementation until later. However, the identity of an interface is still important.

The “As a method of another class” option is incorrect. A method implements a piece of functionality or behavior within a system. An object would not be implemented as a method.

The “As an abstract method of another class” option is incorrect. An abstract method is one that is declared but does not have any implementation details. An object would not be implemented as a method.

=================================================================================
Objective: Development Process
During an interview with your client, the following conversation occurred:

Client: “We need a system that allows entries of work time at the end of the day. Many of these entries will be entered simultaneously.”

You: “OK, so you want to develop a system that acts like a queue and processes each request in a first-in first-out basis, right?”

Client: “That is correct. The first user’s request will take place and the next request will wait for the update. The TimeSheet will then be updated with the new hours worked.”

You: “Excellent. So you need a TimeSheet that holds the time spent doing the daily routines at work….”

After analyzing the above scenario, what are some terms that you can use in related use cases?

Entry, Queue, Container
Entry, TimeSheet
Entry, Queue, TimeSheet, Container
Queue, Container
Answer Explanation: Both Entry and TimeSheet are good use cases that can be extracted from this scenario. Use cases are specifications of a sequence of interactions between an actor and the computer system. Use cases describe the user-visual functionality. Entering data in the Entry use case and viewing the time sheet information in the TimeSheet use case are the only valid options for use cases.

The option “Entry, Queue, Container” is incorrect. Neither Queue nor Container describes the user-visual functionality of a use case.

The option “Entry, Queue, TimeSheet, Container” is incorrect. Queue and Container do not describe the user-visual functionality of a use case.

The option “Queue, Container” is incorrect. The Queue and Container selections do not describe the user-visual functionality of a use case.

=================================================================================
Which component of the class diagram is considered a role name?
Answer Explanation: A line drawn between two classes specifies an association. Each association has two association ends, often called roles. A role name is a label attached to an association end, in this case, items.

The “*” option is incorrect. Multiplicity can also be indicated on an association end. It can be indicated with numbers or an asterisk, which signifies many.

The “name” option is incorrect. Name, as it appears in this class diagram, is an attribute of the Customer class.

The “Customer” option is incorrect. Customer is one of the classes in the diagram.

The “Product” option is incorrect. Product is a class in the diagram, even though it does not specify any attributes or methods.

The “authorizeCharge()” option is incorrect. This is a method of the Credit Card class.

================================================================================
Objective: Dynamic Modeling
Which of the following statements are true concerning incremental development?

Iterative development is composed of many incremental development phases.
Incremental development is composed of many iterative development cycles.
Incremental development refines the system through the same requirements.
Incremental development defines the system in one iterative step.
Answer Explanation: Incremental development is performed by refining the system through each release. As the builds of your project increase, the associated functionality is also increased. An incremental development is associated with many iterative development phases. With frequent incremental releases, you can gain benefits for your project, such as the following:

Early integration and system testing
Early feedback from client on proposed solution
Trust and satisfaction from the user community (assuming the early release of the system is a success)
Trust from the development team with development of the final product

The option “Iterative development is composed of many incremental development phases” is incorrect. Incremental development is composed of many iterative development cycles.

The option “Incremental development refines the system through the same requirements” is incorrect. Iterative development is used to refine the system through the same requirements.

The option “Incremental development defines the system in one iterative step” is incorrect. Incremental development defines the system through several release cycles. Incremental development contains many iterative development cycles, not just one.

=================================================================================
Objective: Static Modeling
Which of the following are true regarding subclassing? (Choose all that apply)

A subclass may have additional attributes of interest.
A subclass cannot have additional associations.
An instance of a subclass should always be able to serve as an instance of its superclass.
A subclass inherits only the interface of the superclass, not the implementation.
Answer Explanation: One good reason for subclassing is when the subclass has additional attributes that do not fit well with the superclass. A subclass has to support all methods and attributes of the superclass. This ensures that a subclass can fulfill the role of the superclass, which is the basis of polymorphic operations.

The “A subclass cannot have additional associations” option is incorrect. This statement is false. A subclass may have additional associations of interest, which is another good reason for subclasses to be created.

The “A subclass inherits only the interface of the superclass, not the implementation” option is incorrect. With subclassing, the subclass inherits both the interface and the implementation of the superclass.

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

Object Oriented Analysis and Design (part 7)

Objective: Architecture
In designing your application, there may be times that multiple threads will be processing requests simultaneously. You can instruct each thread how to behave in this type of environment by setting the concurrency level on each operation.

Which of the following are concurrency options that you can set on operations?

Synchronous
Guarded
Asynchronous
Sequential
Answer Explanation: There are three behaviors that an operation will react to in the presence of multiple threads of control, which are:

Sequential – Only one thread will run at one time. Once the initial thread completes its execution, the second thread of control will run.

Guarded – Classes will collaborate together to ensure each thread is completing its task exclusively. This allows the operations to run smoothly with multiple threads of control.

Synchronous – Operations will perform correctly when run with multiple threads of control. The operation will complete one thread; however, other operations can run other threads simultaneously. Collaboration is not required, since the class takes care of mutual exclusion issues.

The option “Asynchronous” is incorrect. Asynchronous is not a behavior of how an operation will react in the presence of multiple threads of control.

==================================================================================
Objective: Static Modeling
Which of the following statements are true concerning delegation?

Delegation can be used as an alternative to inheritance.
Delegation is a mechanism for implementing polymorphism.
Delegation is specified in a UML diagram with a broken line and hollow triangular arrowhead.
Delegation promotes reuse.
Answer Explanation: Delegation is implemented by an object issuing a message to another object in response to a message. Instead of using inheritance to have a class implement functionality, the class can simply delegate or pass requests or messages to another class for processing. This can achieve the same results as inheritance in an environment where inheritance is not desired. Delegation is a form of interface reuse whereas inheritance is a form of implementation reuse.

The “Delegation is a mechanism for implementing polymorphism” option is incorrect. Delegation is a way to employ reuse of interfaces. Polymorphism is realized by having objects that can take on new forms in subclasses.

The “Delegation is specified in a UML diagram with a broken line and hollow triangular arrowhead” option is incorrect. Since delegation is basically a passing of responsibility, it can be modeled with normal association or aggregation relationships. The broken line and hollow triangular arrowhead signifies an interface implementation relationship.

==================================================================================
Objective: Requirements Modeling
In the Unified Modeling Language, which BEST represents potential actors for an online music store? (Choose all that apply)

An order form
A database administrator
A customer
A compact disc
A printer
Answer Explanation: An actor is an entity that interacts with but is external to the application. Typically, an actor either inputs information into or receives information from the application. This can be a human actor, such as a customer or database administrator, or a non-human actor, such as an external computer system or printer.

The “An order form” option is incorrect. An order form would be part of the system and therefore, is not an actor.

The “A compact disc” option is incorrect. A compact disc is an entity but is not external to the system. It may be better represented as a class within your system.

==================================================================================
Objective: Design and Implementation Techniques
You are redesigning an application that has only a few large classes, which serve the responsibility of the application. You want to make these classes smaller and more efficient.

What is the term that represents this type of design?

Cohesion
Refactoring
Coupling
Pattern
Answer Explanation: When designing an application, you may find it necessary to rename classes, redesign code into multiple methods, or even move classes between packages. This is known as refactoring. You can reassign responsibilities to other classes, resulting in lowering the cohesion of a class. Refactoring an application results in changing the internal structure, in small steps, to make it easier to understand and use.

The option “Cohesion” is incorrect. Cohesion is a measure of the responsibilities of a class. If a class has low cohesion, it means that the class does too much work or many unrelated tasks. These types of classes are hard to comprehend, reuse and maintain. This type of class is good to redesign through refactoring.

The option “Coupling” is incorrect. Coupling defines how much one class depends on another class. Low coupling occurs when a class does not largely depend on another class, whereas a class with high coupling greatly depends on another class for its existence. Refactoring deals with renaming and moving classes in your program design.

The option “Pattern” is incorrect. A pattern is a description of general principles and idiomatic solutions that help you develop software. The type of design in this question is best represented by refactoring.

==================================================================================
You are developing an ordering application that will be used at a local shoe factory. The application will take an order, and process the order line by line to fill the order. You are designing the activity diagram that will be used to show the concurrent action of the order line items being filled.

Which of the following diagrams is the BEST example to show dynamic concurrency in the Fill line order transition in an activity diagram?

Answer: C
Answer Explanation: Dynamic concurrency invokes actions or sub activities multiple times in parallel, based on an expression. They show iterations without the need to construct a loop in an activity diagram. A multiplicity marker (*) is used to show that an activity occurs many times. The final transition to complete the delivery is only executed once the Fill Line Items transition has finished.

The “A” option is incorrect. The percent sign (%) is not used to show multiplicity in a dynamic concurrency model in an activity diagram. To show dynamic concurrency in an activity diagram, you would use the multiplicity marker (*).

The “B” option is incorrect. The dollar sign ($) is not used to show multiplicity in a dynamic concurrency model in an activity diagram. You must use the multiplicity marker (*) to show dynamic concurrency in an activity diagram.

The “D” option is incorrect. The ampersand sign (&) is not used to show multiplicity in a dynamic concurrency model in an activity diagram. A multiplicity marker (*) is used to show dynamic concurrency in an activity diagram.

=================================================================================
Which of the following diagrams illustrates a package dependency?

Answer: C

Answer Explanation: The proper method to illustrate a package dependency in the Unified Modeling Language (UML) is to draw the packages with a connected broken line and point to the package on which the first package depends. The presence of a dependency in a package implies that elements inside of one package depend on elements inside the second package. Package-level dependency does not contain further information; it is only a summary.

The “A” option is incorrect. This option suggests that there is no dependency between the two packages.

The “B” option is incorrect. This option suggests that there is no dependency between the two classes.

The “D” option is incorrect. This option suggests that there is a dependency between two classes, not two packages.

=================================================================================
Objective: Architecture
Which of the following are reasons to group classes into packages? (Choose all that apply)

When the classes share the same use cases
When the classes have strong associations with one another
When the classes are closely related to the same subject area
When the classes share the same class hierarchy
Answer Explanation: There are a number of reasons why classes should be grouped together into packages, including:

When classes are closely related to the same subject area, concept, or purpose
When classes have the same class hierarchy or use case
When classes have a strong association with one another
When classes are used by many packages

In order for a package to be workable, the allocation must follow a rational process, such as common functionality, common viewpoint, or tightly coupled implementation.

==================================================================================
You are designing a system that schedules seating for hockey games. The diagram of the TicketSales use case is as follows,
Which of the following labels would best describe lines 1, 2, and 3 respectively?

Extends, includes, includes
Includes, extends, extends
Includes, includes, extends
Extends, extends, includes
Includes, includes, includes
Answer Explanation: You would use the «includes» relationship when you have a chunk of material that is repeated in two or more separate use cases and you wish to avoid this repetition. In this case, the Purchase Ticket use case would include the Search for seats for hockey games use case. You would use the «extends» relationship when describing a variation on normal behavior and need further control, by declaring your extension points in your base use case. In this case, the Ticket Delivery use case can be mailed or picked up at the box office, which is represented by the Pickup Ticket and Mail Ticket use cases.

The option “Extends, includes, includes” is incorrect. These are not the proper relationships between the use cases presented in the diagram. The first relationship should be the «includes» relationship, since the Purchase Ticket use case would include a search feature for available seats. The second and third relationship would be «extends» relationships, since the Pickup Ticket and the Mail Ticket use cases would extend the Ticket Delivery use case.

The option “Includes, includes, extends” is incorrect. These are not the proper relationships between the use cases presented in the diagram. The first relationship should be the «includes» relationship, since the Purchase Ticket use case would include a search feature for available seats. The second and third relationship would be «extends» relationships, since the Pickup Ticket and the Mail Ticket use cases would extend the Ticket Delivery use case.

The option “Extends, extends, includes” is incorrect. These are not the proper relationships between the use cases presented in the diagram. The first relationship should be the «includes» relationship, since the Purchase Ticket use case would include a search feature for available seats. The second and third relationship would be «extends» relationships, since the Pickup Ticket and the Mail Ticket use cases would extend the Ticket Delivery use case.

The option “Includes, includes, includes” is incorrect. These are not the proper relationships between the use cases presented in the diagram. The first relationship should be the «includes» relationship, since the Purchase Ticket use case would include a search feature for available seats. The second and third relationship would be «extends» relationships, since the Pickup Ticket and the Mail Ticket use cases would extend the Ticket Delivery use case.

================================================================================
Objective: Development Process
Basically, a use case is a chunk of functionality that will be provided to the overall system. Use cases can be thought of as services that a customer requires. Use cases are written in a manner that is easy for the end users to understand and describe what the system will do. Interaction diagrams are created from these use cases.

When scheduling project activities based on use cases, which of the following are good candidates to consider for development in early iterations? (Choose all that apply)

Options that may impact the architectural design
Options that may involve new technologies
Options that represent the primary line of business
Options that involve well-established existing technologies
Answer Explanation: Iterations are ranked on risks, coverage, and criticality. Criticality refers to the amount of business value that the requirement provides for the business. Early iterations may influence later analysis and design of your system. You can design project activities from use cases. Good candidates to consider for project activities early in your development include the following:

Options that impact the architectural design – Since the design of your system will be a major factor, redesigning parts of your system later may result in unnecessary additional work.

Options that may involve new technologies – New technologies may involve risky software that may change, which can result in a possible redesign of parts of your system.

Options that represent the primary line of business – Project activities that relate to the primary line of business should be dealt with early in the development process because these tasks are paramount to your software development.

The option “Options that involve well-established existing technologies” is incorrect. Use cases for well-established technologies do not need to be developed in the early stages of software development.

=================================================================================
Objective: Static Modeling
Which of the following are valid ways to specify an interface in a class diagram? (Choose two)

A rectangle symbol with the «interface» keyword
A small hollow circle symbol with the name of the interface below it
A rectangle with rounded edges with the name of the interface below it
A small solid circle with the name of the interface below it
Answer Explanation: An interface can be modeled in one of two ways; either with a class symbol with the «interface» keyword, or a small hollow circle symbol with the name of the interface below it. An interface basically specifies a set of operations that are visible to the client, without specifying the internal structure of the operations.

The “A rectangle with rounded edges with the name of the interface below it” option is incorrect. Rounded rectangles are used to represent states in state diagrams.

The “A small solid circle with the name of the interface below it” option is incorrect. A solid circle is used to represent the starting point in an activity diagram or state diagram.

=================================================================================
Objective: Dynamic Modeling
You are creating a state diagram for a local college. In your state diagram, you will show how events affect an object.

Which of the following statements are true concerning the use of events in state diagrams? (Choose all that apply)

State diagrams can show events in a sequential sequence.
State diagrams can show events in a concurrent sequence.
State diagrams can show events in a recursion sequence.
State diagrams can show events in an abstract sequence.
Answer Explanation: State diagrams are used to show how an object will live throughout various states within your system. State diagrams can show sequential sequence and concurrent sequence. Events will occur one after another (sequential sequence) or in parallel (concurrent sequence).

The option “State diagrams can show events in a recursion sequence” is incorrect. A sequence diagram can show recursion, where an object will send a message to itself. State diagrams can show events in a sequential and concurrent sequence.

The option “State diagrams can show events in an abstract sequence” is incorrect. Abstract is a keyword used with classes. An abstract class is a class that does not have enough state to be instantiated on its own. Abstract classes need to be subclassed to be instantiated. State diagrams can show events in a sequential and concurrent sequence.

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

Object Oriented and Analysis with UML (part 6)

Objective: Architecture

When designing packages that are to be cohesive, reusability is a key factor.

Which one of the following is a key factor in determining a package with a high level of cohesion?

Creating elements that do not have a specific purpose, but have a range of functionality
Creating many elements that complete individual tasks, which form together to complete an overall goal
Creating one element that completes many specific tasks to complete an overall goal
Creating course-grained elements
Answer Explanation: When you design a system, you should strive to get a high degree of cohesion in your system. The elements found in a system with a high level of cohesion are focused on performing individual tasks. Each task combines to complete the overall purpose of the system. Having classes that only perform an individual task will promote reuse within your classes. Cohesive packages with fine-grained classes promote reusability as the fine-grained classes can be combined together to provide course-grained functionality.

The option “Creating elements that do not have a specific purpose, but have a range of functionality” is incorrect. Elements designed in this nature will have a low cohesion factor, where the element cannot be easily reused in another application.

The option “Creating one element that completes many specific tasks to complete an overall goal” is incorrect. Elements formed in this manner do not conform to the rules of cohesion, where the overall goal of the element is not well defined. Elements of this type are coarse-grained, resulting in a lack of cohesion in your application, where the elements are not easily reused.

The option “Creating course-grained elements” is incorrect. Coarse-grained elements lack cohesion as they cannot easily be reused. For a highly cohesive system, you would want to design elements that are fine-grained. These fine-grained classes can be assembled together to complete the overall system.

==================================================================================
Objective: Architecture
You are designing a software system. There are five key views in designing your system: logical view, process view, use-case view, implementation view, and deployment view. The main actors in the process view are system integrators.

What will have the most influence on the actions of the system integrators in the process view?

Functionality
Structure
Software management
System topology
Performance
Answer Explanation: The process view of a system is a description of the system’s decomposition. It is broken down into processes and tasks, as well as the communication and synchronization among concurrent elements. This view is important to system integrators, who will address the performance, scalability, and throughput of the system.

The option “Functionality” is incorrect. The use case view deals with the functionality of a system and what the end user will see. The process view deals with performance of the system.

The option “Structure” is incorrect. The logical view structures the system and can be used to gain vocabulary to describe the system. The process view deals with performance of the system.

The option “Software management” is incorrect. The implementation view deals with software management. The implementation view of a system captures the artifacts as seen by programmers. The process view deals with performance of the system.

The option “System topology” is incorrect. The deployment view deals with the system that is necessary for deployment. The process view deals with performance of the system.

=================================================================================
Objective: Static Modeling
Through which type of relationship does a class connect to an interface?

Generalization
Realization
Association
Dependency
Answer Explanation: Although a realization relationship can be used in other situations, it is mainly used to connect a class to an interface. When a class realizes an interface, it must provide implementation for the operations specified in the interface.

The “Generalization” option is incorrect. A generalization relationship is a relationship between a more general component and a more specific component. This relationship is the basis of inheritance.

The “Association” option is incorrect. Associations are relationships between instances of classes; such as a company has employees. It cannot be a relationship between a class and an interface.

The “Dependency” option is incorrect. This is a relationship where one class delegates responsibility to another class.

=================================================================================
Objective: Development Process
You are designing a system. As the system grows, it becomes more complex, and contains many classes.

Which of the following can be done to structure and organize the architecture of your system? (Choose two)

Maximize dependencies between packages to improve performance.
Group classes with similar purposes into organized packages and define a public interface for each package.
Place view class, model classes, and infrastructure classes in every package.
Use layers to design your system.
Answer Explanation: Grouping classes with similar purposes into organized packages and using layers to design your system would structure and organize the architecture of a large complex program. Packages should contain elements that provide a common service with high coupling and collaboration. Packages should not have coupling and collaboration between elements of other packages. You should layer the design of your application so that common types of packages are in the same layer.

The option “Maximize dependencies between packages to improve performance” is incorrect. Packages that are dependent on other packages are coupled to the elements of the target package. Since changing one package may affect another package that is coupled to the package that you are changing, increasing the package dependencies will not organize or structure the architecture of your system.

The option “Place view class, model classes, and infrastructure classes in every package” is incorrect. Keeping the layers of your design separate, such as the view classes, model classes, and infrastructure classes, will keep coupling low and result in a well designed application.

==================================================================================
Objective: Dynamic Modeling
When creating state diagrams in UML, you define a number of states that a single class can have. This makes state diagrams useful for showing the lifecycle of a class.

Which of the following best describes the response of an object to an event?

Activities and reactions
Activities and actions
Actions and reactions
Activities, actions, and reactions
Answer Explanation: A state diagram defines the external stimuli of the system, which are the events. These events cause activities and actions to occur. You use activities and actions to describe the response of an object to an event. An activity is associated with a state and is used for control purposes, where an action is associated with an event, but is not relevant for control purposes.

The option “Activities and reactions” is incorrect. Activities and actions are used to describe the response of an object to an event, not activities and reactions. The term ‘reactions’ is not a UML defined keyword.

The option “Actions and reactions” is incorrect. Activities and actions are used to describe the response of an object to an event; reactions is an invalid term.

The option “Activities, actions, and reactions” is incorrect. Only activities and actions are used to describe the response of an object to an event; reactions do not describe the response of the object to the event.

=================================================================================
Objective: Development Process
An interface is a descriptor for external operations of a class. A class may support many interfaces and many classes may implement the same interface.

Which of the following are true statements about interfaces? (Choose all that apply)

An interface contains a collection of operations.
An interface defines a service that a supplier provides.
An implementing class must declare all operations in the interface.
An implementing class can add more operations than the interface provides.
Answer Explanation: An interface specifies a service of a class by a collection of operations it contains. An interface does not offer any definition of its operations. Any class that implements an interface will need to declare all of the operations in the interface and add additional operations as needed.
==================================================================================
You are designing a state diagram for your new stereo system software. You are trying to determine how you can best show a mute button that controls the volume level. You create the state diagram displayed in the exhibit
Which of the following software components could be derived from the state diagram in the exhibit? (Choose all that apply)

A Volume object that has a level integer and an On attribute of type boolean, with methods to increase and decrease the volume level of the stereo
A condition that increases the volume if the On attribute is set to true
A condition that decreases the volume if the On attribute is set to true
All of the options are correct
Answer Explanation: State diagrams show the life-cycle of an object. In a state diagram, guard conditions are shown encompassed in square brackets ([]). In this state diagram, there is a Volume object that has a level attribute of type integer, and an On attribute of type boolean with methods to increase and decrease the volume level of the stereo. The level attribute controls the level of the stereo. The On attribute indicates if the mute button is on or off. The object would need methods to control the level of volume, such as an increaseVolume method and a decreaseVolume method.

The option “A condition that decreases the volume if the On attribute is set to true” is incorrect. With the On attribute set to true, the condition displayed in the exhibit would guard against an increase in volume.

The option “All of the options are correct” is incorrect. Not all of the statements concerning software components that could be derived from the state diagram are true.

=================================================================================
Objective: Static Modeling
Which of the following give indications as to which methods will exist in the system design? (Choose two)

Messages between objects in a collaboration diagram
Nouns in use cases
Verbs in use cases
Messages between nodes in a deployment diagram
Answer Explanation: The messages between objects in collaboration diagrams and sequence diagrams represent the responsibilities of the object receiving the message. These responsibilities translate into methods in the software design.

Verbs in a use case are a good indication of the required operations for the system. They are normally implemented as methods in classes.

The “Nouns in use cases” option is incorrect. Nouns in use cases are representative of potential classes, not methods.

The “Messages between nodes in a deployment diagram” option is incorrect. A deployment diagram shows the distribution of software components in relation to the hardware components of a system. Deployment diagrams would not give any indication of the methods in the system.

==================================================================================
Objective: Development Process
You are redesigning a system that an ex-coworker designed. You determine that there are better ways to achieve a more effective placement of responsibilities. You move several methods from one class to another class.

What OOAD artifacts will need to be updated to reflect the changes that you have made? (Choose two)

Use cases
Class diagrams
State diagrams
Interaction diagrams
Activity diagrams

// <![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: When refactoring public methods from one class to another, the class diagrams and interaction diagrams may need to be updated to reflect these changes. A class diagram is a graphical representation of the model elements, such as classes, types, and their contents and relationships. Changing a method from one class to another might affect the contents of the class diagram. A class diagram contains certain elements whose dynamics are expressed using other diagrams, such as collaboration diagrams. An interaction diagram is a generic term that applies to types of diagrams that emphasize object interactions. These include collaboration and sequence diagrams.

The option “Use cases” is incorrect. Use cases are a representation of the internal structure of the system and will not require updating if the internal components of a class are modified.

The option “State diagrams” is incorrect. State diagrams are used to model complex, dynamic behavior of classes. It shows the life cycle of objects within a class as they are moved between states. State diagrams are not updated if the internal components of a class are modified.

The option “Activity diagrams” is incorrect. An activity diagram is a diagram that shows an activity graph. An activity graph shows a procedure or a workflow. These are special cases of state that are triggered by the completion of activities in the source states. Activity diagrams are not updated if the internal components of a class are modified.

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

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.

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

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.

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

Object Oriented and Analysis with UML (part 3)

You are creating a banking application that will take queries from users. The application must be able to simultaneously debit and credit the appropriate accounts.

Which of the following diagrams allow you to show parallel or concurrent behavior in your program? (Choose three)

Activity diagram
State diagram
Class diagram
Sequence diagram
Answer Explanation: Activity diagrams, state diagrams, and sequence diagrams all can be used to show parallel or concurrent behavior in your program. An activity diagram is a diagram that shows an activity graph. The activity graph shows the sequential and concurrent steps of a computational procedure. State diagrams are used to describe the behavior of the system, such as any concurrent or parallel behavior. A sequence diagram shows the progression of messages in a time sequence.

The option “Class diagram” is incorrect. A class diagram is a description of objects and object relationships. A class diagram would not be a good diagram to use to show parallel or concurrent behavior. Activity, state, and sequence diagrams would be better used to show parallel or concurrent behavior in your program.

==================================================================================
You are designing a project for a large banking institution. In your state diagram, you are using guards that will determine if the client has sufficient funds to withdraw a specified amount.

Which of the following options is the best method of implementing an action on a transition, which contains a guard condition, in a UML state diagram?

If a particular transition has an action, you will need to append the action name to the event guard.
If a particular transition does not have an action, you will need to append the action name to the event guard.
Append the action name to the transition that has an action.
Append the action name to the event guard for every action.
Answer Explanation: Actions and activities are used to specify the functional transformations and computational behavior of objects in a class. Actions are used to specify some task to be completed as an object makes a transition. Actions are shown in state diagrams by appending “/action-name” to the “event [guard]” for every transition that has an action. An example of the use of actions for a banking application in an UML state diagram is as follows:Withdraw(amt)[amt<=AccBalance] /DecreaseBalance
When the Deposit function is called with an amt, the action of this is that the IncreaseBalance function is called.

The option “If a particular transition does not have an action, you will need to append the action name to the event guard” is incorrect. If a transition has an associated action, the action is shown with a forward slash character (/). The transition could also have a guard that will determine if the transition will fire. You will need to append the action name to the event guard for every transition that has an action. If there is no event guard, the action will occur regardless.

The option “Append the action name to the transition that has an action” is incorrect. You would need to append the action name to the event guard for every transition that has an action, not directly to each transition that has an action.

The option “Append the action name to the event guard for every action” is incorrect. Appending the action name to the event guard for every transition that has an action is the best way to implement an action on a transition in an UML state diagram.

==================================================================================
Which of the following diagrams should be implemented with inheritance?
Answer Explanation: Inheritance is best used to model a generalization relationship. This relationship models classes that have many similarities that can be grouped together in a more general superclass, making it a perfect situation for inheritance.

The “A” option is incorrect. This is a composition relationship. Composition is a whole/part relationship where a part can only belong to one whole at a time. This type of relationship cannot be modeled with inheritance.

The “B” option is incorrect. This is an association diagram. An association diagram models relationships between instances of classes. Since these classes would not necessarily have common attributes or behavior, inheritance does not apply.

The “C” option is incorrect. This is a package diagram that shows the dependency between classes. Dependencies between packages are not modeled with inheritance.

=================================================================================
Which diagram displays the use of a qualified association?
Answer Explanation: A qualified association is one between two classes that uses a qualifier value that distinguishes the set of objects at the far end of the association. It is essentially a parameter. In the diagram, without the Account # qualifier, the Bank-to-Person relationship would have to be modeled as many to many (* – *) instead of many to 0 or 1(* – 0..1).

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

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

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

=================================================================================
You are designing a class. This class will transition between different states.

What can you place on a transition that will conditionally fire depending on a Boolean value?

Guard
Event
Action
Super State
Answer: Guard
Answer Explanation: Transitions are the changing of an object from one state to another. Guard conditions are Boolean expressions that are part of the specifications of a transition, and must be true before an object can change state.

The option “Event” is incorrect. Events are specific occurrences. An event can trigger a state transition. Events do not conditionally fire depending on a Boolean value. Guards conditionally fire depending on a Boolean value.

The option “Action” is incorrect. Once a transition fires, its action is executed. Actions do not conditionally fire depending on a Boolean value.

The option “Super state” is incorrect. Super states are used to generalize a portion of the diagram. Super states are not dependant on a Boolean value to conditionally fire.

=================================================================================
Which of the following statements are true of association classes?
An association class itself cannot participate in an association.
The class symbol is attached to the association line using a broken line.
The class symbol and association line are considered a single entity.
The broken line of the association class can include multiplicity.
Answer Explanation: The class portion of an association class is attached to the association line with a broken line. This combination is regarded as a single component in the UML.

The “An association class itself cannot participate in an association” option is incorrect. Since they are much like regular classes, association classes can have associations of their own.

The “The broken line of the association class can include multiplicity” option is incorrect. The broken line simply serves to attach the class to the association line. It has no semantic value.

=================================================================================
Which use case model concept is used?
Realization
Generalization
Include
Extend
Answer Explanation: The UML notation for the generalization relationship is a solid line with a hollow triangle running from the more specific to the more general component.

The “Realization” option is incorrect. The UML notation for a realization relationship is a broken line with a hollow triangle. It is normally used in a class diagram to specify a realization relationship between a class and an interface.

The “Include” option is incorrect. The include relationship in a use case diagram is used to denote a use case that “includes” another use case. It is specified by a broken line with an open arrowhead that runs from the base use case to the use case that it includes.

The “Extend” option is incorrect. The extend relationship in a use case diagram is specified by a broken line with an open arrowhead running from the extended use case to the base use case. This relationship is much like the generalization relationship, but includes more specific details about the variation in behavior.

=================================================================================
Diagrams in the UML can represent activities, classes, use cases, sequence diagrams, etc. Each of these diagrams serves a specific purpose in designing your application.

Which of the following UML diagrams show nodes with packages, modules, objects and operating system processes?

Use case diagram
Deployment diagram
State diagram
Component diagram
Answer Explanation: A UML deployment diagram depicts the physical resources in a system including nodes, components, and connections. Components represent run-time elements of code units. Developers can model these physical resources and network connections to be used in their applications. Nodes are used to represent physical entities, such as computers, printers, etc. On these nodes lie the packages, modules, objects, and processes (as in operating system processes).

The option “Use case diagram” is incorrect. Use case diagrams do not show nodes with packages, modules, objects, and operating system processes. Use case diagrams show the relationships among use case actors and use cases within a system.

The option “State diagram” is incorrect. Also known as a statechart diagram, this type of diagram displays the states of an object that are created by transitions. State machine is a specification of the sequences of states that an object or an interaction will encounter during its life cycle.

The option “Component diagram” is incorrect. A component diagram is a diagram that displays the component architecture of the system.

=================================================================================
Which of the following statements are true of qualified associations?

A qualifier is only used on an association with a “many” multiplicity in the target direction.
It is common to use a qualifier to select a single object from a set of related objects.
A qualifier is normally an attribute of the source object.
The qualifier rectangle is part of the source class.
Answer Explanation: A qualifier value is normally used to select a single object from a set of objects, such as an array. In the case of an array, the qualifier will be the array index value. If the target were not a set of objects, but a single object, there would be no need for a qualifier.

The “A qualifier is normally an attribute of the source object” option is incorrect. Since the target is a set of objects from which one object will be selected, the qualifier will normally be an attribute of the target. This is apparent in a Bank-to-Customer relationship. Since a Bank object will be associated with many Customer objects, a customerID attribute would normally be used as a qualifier.

The “The qualifier rectangle is part of the source class” option is incorrect. The qualifier rectangle is a part of the association itself, not the target or source classes.

================================================================================
Which of the following are true concerning subtyping? (Choose all that apply)

Using a bound element is the same as subtyping.
There is no difference between realization and subtyping in a specification model.
From the specification perspective, generalization refers to inheritance through subclassing.
Subtyping can be used with packages.
Answer Explanation: In a specification model, subtyping involves generalization/specialization through interfaces. A class’ relationship to an implemented interface is a realization relationship. You can also use subtyping, or generalization, with packages. When a generalization relationship is used with packages, the specific package, or subpackage, must conform to the interface of the general package.

The “Using a bound element is the same as subtyping” option is incorrect. When using a bound element, the addition of methods or attributes is not permitted as it is with subtyping.

The “From the specification perspective, generalization refers to inheritance through subclassing” option is incorrect. Generalization through inheritance of superclasses is associated with the implementation perspective, not the specification perspective.

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

Object Oriented and Analysis with UML (part 2)

Objective: Architecture

You are designing an application that will be responsible for a library of books. These books are stored in a SQL 2000 database called pubs.

What is the term called that signifies a general design pattern of wrapping the infrastructure logic into a component?

Generalization
Facade
Brokering
Cohesion

Answer Explanation: Brokering is defined as an agent that acts for others (as negotiating contracts, purchases, or sales), in return for a fee or commission. In the case of programming terms, brokering is a general design pattern of wrapping the infrastructure logic inside a set of special-purpose classes that hides the logic from your domain model. An example of the infrastructure logic would be to access a database. You could have a class that accesses a particular type of database that could be re-used with many applications.

The option “Generalization” is incorrect. Generalization is the activity of finding a common set of concepts. A concept can be defined as a supertype (general concept) or subtype (specialized concept) relationship. This is not a term that signifies a general design pattern of wrapping the infrastructure logic into a component.

The option “Facade” is incorrect. A facade is a common interface to a disparate set of interfaces. This is not a term that signifies a general design pattern of wrapping the infrastructure logic into a component.

The option “Cohesion” is incorrect. Cohesion is a measure of the responsibilities of a class. How do the responsibilities measure to one particular task? A class with a high amount of responsibility and does not do much work has high cohesion.
================================================================================which of the following purposes should a use case be implemented?Answer: To document the high-end functionality a system provides to an actorTo illustrate the behavioral requirements of a process
Answer Explanation: The main purpose of a use case is to capture the high-end functionality requirements of a system or subsystem, without specifying any technical details about how the functionality will be realized. Use cases describe the sequence of events that should take place, including alternate and error sequences, when an actor interacts with a system.

The “To map the implementation of a discrete unit of functionality within a system” option is incorrect. A use case should not include any details about the internal structure or the implementation of the system functionality being described.

The “To illustrate the interaction between two or more classes” option is incorrect. A collaboration diagram is normally used to illustrate the interaction between classes. A use case documents the interaction between the system and an actor external to the system.

The “To document an individual step or activity within a larger scenario” option is incorrect. A use case normally includes a main path of events as well as alternate paths and error paths. Each specific path through the use case is known as a use case instance. Each instance describes a particular scenario. There are normally multiple scenarios associated with each use case.
=================================================================================Since superstates cannot be directly accessed, substates are used to enter superstates. Which of the following options are similar to this feature of superstates?

Abstract class
Concrete class
Aggregate class
Composite class

Answer Explanation: Superstates are represented by large rectangles with rounded corners that encompass the states. Superstates are like abstract classes, since abstract classes cannot be directly instantiated; instead, abstract classes need to be instantiated as part of a derivative. Superstates cannot be entered directly; superstates can only be entered as part of a substate. Substates are states within a superstate.

The option “Concrete class” is incorrect. Concrete classes can be directly instantiated. Since a superstate cannot be directly accessed, superstates are not similar to concrete classes. Abstract classes cannot be instantiated, making abstract classes very similar to superstates.

The option “Aggregate class” is incorrect. An aggregate class is the class that represents the whole part in an aggregation association, which does not make aggregate classes similar to superstates.

The option “Composite class” is incorrect. A composite class is a class that is related to one or more other classes by a composition relationship, which does not make composite classes similar to superstates.
=================================================================================
Which of the following symbols would best represent a condition-clause in the UML?

[x > y]
x > y
< x >
[x y]

Answer Explanation: A conditional clause is an iteration expression that represents the condition under which a particular message will be executed. You can represent conditionals based on the truth of a condition-clause. In the UML diagrams, you can express a condition-clause either using pseudocode or an actual programming language. An example of a condition clause ([condition-clause]) would be as follows:[x < y]

The option “x > y” is incorrect. A condition-clause in the UML is best represented by [x > y].

The option “< x >“ is incorrect. In this expression, there is no comparison that would represent the condition-clause.

The option “[x y]” is incorrect. In this expression, there is no comparison that would represent the condition-clause.
================================================================================
You are designing an interaction diagram. If the quantity of a product currently in stock falls below a certain level, you need to create a new order to replenish the inventory. You decide that this is best done by using a conditional message in your collaboration diagram.

Which of the following diagrams BEST represents a conditional message in your collaboration diagram?

Answer: A
Answer Explanation: Conditional messages mean that under certain conditions an action will be taken. Conditional messages are a means to determine if a certain message will be sent. To illustrate the message, you use square brackets ([]). When the condition in the square brackets becomes true, the message is sent. In this case, when the inventory falls beneath a determined level, the InventoryLow variable is set to true and the proper stock will be reordered. This can be demonstrated using an illustration presented in the image labeled A.

The “B” option is incorrect. The proper way to illustrate conditional messages in collaboration diagrams is by using syntax similar to [InventoryLow]: Reorder to conditionally order new inventory if the InventoryLow variable is set to true.

The “C” option is incorrect. Using round brackets do not illustrate conditional messages. To show conditional messages in collaboration diagrams, syntax similar to [InventoryLow]: Reorder is used to conditionally order new inventory if the InventoryLow variable is set to true.

The “D” option is incorrect. Double quotes do not show conditional messages. The proper way to illustrate conditional messages in collaboration diagrams is using syntax similar to [InventoryLow]: Reorder to conditionally order new inventory if the InventoryLow variable is set to true.
==================================================================================
Multiplicity is a specification of the range of legal values for a particular component or set.

Which diagrams normally use multiplicity? (Choose all that apply)

Use case diagrams
Class diagrams
State diagrams
Activity diagrams

Only class diagram

Answer Explanation: Class diagrams usually use multiplicity to specify the number of objects in the particular role. The multiplicity is attached to each association end.

The “Use case diagrams” option is incorrect. Use case diagrams specify the relationship between actors and the requirements of the system. Multiplicity is not needed in this type of diagram, since there is usually only one actor related to one instance of a use case.

The “State diagrams” option is incorrect. State diagrams show the possible states that an object can be in at any given time and specify the events that can change the object’s state. Since they normally deal with a single class, state diagrams have no use for multiplicity.

The “Activity diagrams” option is incorrect. An activity diagram shows the sequence of activities within a process or system. It does not show multiplicity.
===============================================================================
You are using certain OOAD artifacts to determine the functional requirements for a system.

Which one of the following cannot be used to capture non-functional requirements?

Class diagrams
Use cases
Interaction diagrams
State diagrams

Answer: Use Cases
Answer Explanation: Use cases cannot be used to capture non-functional requirements. Non-functional requirements include scalability, maintainability, etc. Use cases can however, capture functional requirements, and they drive all other project activities.

The option “Class diagrams” is incorrect. Class diagrams represent the structure of the system under development.

The option “Interaction diagrams” is incorrect. Interaction diagrams are used to model the dynamic behavior of the system.

The option “State diagrams” is incorrect. State diagrams are used to show how a single object behaves across many use cases.
=================================================================================
You are updating an existing project that handles car rentals. You need to modify the existing model. You are given a legacy database diagram, the use case requirements for the project, and an existing partial modeling class diagram

You note that the class diagrams and database schema do not exactly match the model and table relationships; however, all state data exists in both. Based on this information, what advice can you offer? (Choose all that apply)

The relationships that exist in the class diagram and the database schema do not have to precisely match and no changes are needed in this aspect.
The relationships in the class diagram should be changed to match the database schema, since the database is used by legacy systems.
The class diagram should be changed to capture the database fields, since the most important portion of a class diagram is the data.
The class diagram should be expanded to include all of the required behaviors.

Answer Explanation: The database schema contains a description of the data model to be used for storage and retrieval of data in a database. To represent the database schema in a UML model, you use the «schema» stereotype in a package. Class diagrams can be used to represent the database schema. The class diagrams in this scenario are unnecessary to change, since all state data exists in both the database schema and class diagrams. Class diagrams are used to show you the static nature of your system. In a class diagram, the first compartment represents the class name, the second shows the class’ structure (attributes), and the third compartment represents the class’ behavior. A class diagram should include classes that have the structure and behaviors defined.

The option “The relationships in the class diagram should be changed to match the database schema, since the database is used by legacy systems” is incorrect. The class diagrams in this scenario are unnecessary to change, since all state data exists in both the database schema and class diagrams.

The option “The class diagram should be changed to capture the database fields, since the most important portion of a class diagram is the data” is incorrect. Class diagrams are used to show you the static nature of your system. In a class diagram, the first compartment represents the class name, the second shows the class’s structure (attributes), and the third compartment represents the class’s behavior.
=================================================================================
Which diagram displays the correct use of generalization?

Answer: B
Answer Explanation: A generalization relationship between classes is indicated by a line with a hollow triangular arrowhead running from the more specific to the more general class.

The “A” option is incorrect. The hollow triangular arrowhead is the correct representation of a generalization relationship but must run from the more specific to the more general class.

The “C” and “D” options are incorrect. A line with an open arrowhead between classes represents an association relationship.

=================================================================================
You are discussing the requirements of a department store system with the manager of the store. After taking notes in an informal requirements document, you decide to create use cases.

Which list contains the most appropriate terms to be used in your use cases?

End user, manager object, customer object, and product array
Employee interface, customer interface, product container, and print queue
Employee, customer, products, and receipt
Employee ID, customer, product cache, and printer interface

Answer Explanation: Use cases should always use the language of the domain. They are created from the point of view of users of the system (in this case, most will be cashiers), who may know very little about object-oriented design or programming terms.

All other options are incorrect. Programming terms such as object, array, interface, container, queue or cache should not be included in use cases.
=================================================================================

Object Oriented and Analysis with UML (part 1 – 10 questions)

Objective: Design and Implementation Techniques

1.  Which circumstances should you start implementing your program code?
Answer Explanation: When you start to implement your program, it is best to have a core part of your design solidified first. Once you have a set of solidified classes/packages, you can implement them. If there are parts of your program that are not solidified, you should not implement these sections of code, as they may change radically.

You should have most of your program design solidified before you start the implementation of your program.

If you do not create a program model before you start to implement your program code, the overall development time of the system can increase. You should have most of your program design solidified before you start the implementation of your program.

Although you can review other developers’ code to create your own coding pattern, this will not generally assist in implementing your program design. You should have most of your program design solidified before you start the implementation of your program.

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

Objective: Requirements Modeling

2. When examining a requirements document, which is BEST to concentrate on for the development of initial use cases?Answer Explanation: Business requirements represent the main goals and purpose of the system. It is these use cases that should be expanded to expose and develop the high-risk requirements for the first iteration of development.Security requirements, hardware requirements, and classes are not considered when developing initial use cases.===============================================================================
3. Objective: Dynamic Modeling
When developing a system for your client, you incrementally release milestones to generate feedback for your project. These milestones would be released at set intervals of the project’s iterative life-cycle, which consists of the Plan and Elaborate phase, the Build phase, and the Deploy phase. Each of these three phases may contain multiple development cycles.

Which of the following indicates the correct order of a development cycle?

Testing, analysis, implementation, and design
Analysis, implementation, design, and testing
Analysis, design, implementation, and testing
Analysis, design, testing, and, implementation

Answer Explanation: An iterative life-cycle is based on building and refining the system through multiple development cycles of analysis, design, implementation, and testing. The system grows through each development cycle, in which additional functionality is added within each development cycle. Each of these cycles addresses a small set of requirements, proceeding through the analysis, design, implementation, and testing phases. With iterative development, the complexity is not overwhelming and early feedback is generated with a working subset of the system.

The option “Testing, analysis, implementation, and design” is incorrect. This is not the correct order for an iterative life-cycle. In an iterative life-cycle, first the project is analyzed, designed, implemented, and finally tested for distribution.

The option “Analysis, implementation, design, and testing” is incorrect. This is not the correct order for an iterative life-cycle. The iterative life-cycle begins with analysis, proceeds with design and implementation respectively, and finishes with testing.

The option “Analysis, design, testing, and, implementation” is incorrect. This is not the correct order for an iterative life-cycle. Testing is the final stage of the iterative life-cycle and implementation is conducted prior to testing.=================================================================================4. Which of the following UML components is BEST used to examine the behavior of several objects within a single use case?Class Diagram (0r) Interaction Diagram (or) Use case Diagram (or) Activity DiagramAnswer Explanation: Interaction diagrams are especially useful for showing the correlation between two or more objects within a single use case. There are two types of interaction diagrams to choose from: sequence diagrams and collaboration diagrams. Both these types of diagrams convey the same message, but in a slightly different format.

The “Class diagram” option is incorrect. Class diagrams are best employed to display the types of objects in a system and the static relationships they have with each other. They are not very good at displaying the behavior of objects.

The “Use case diagram” option is incorrect. Use case diagrams are best used for demonstrating relationships between the various use cases of the system and the actors that initiate them. Use case diagrams do not contain classes.

The “Activity diagram” option is incorrect. An activity diagram is much like an interaction diagram but is best used to display object behavior over many use cases or many threads.=================================================================================5. Objective: Static Modeling
When searching use cases and requirements documents for candidate classes, it is best to concentrate on:

Nouns
Adjectives
Verbs
Actors

Answer Explanation: Since a noun, by definition, is a person, place, thing, or idea, nouns will represent most of the candidate classes in your system. Consider the following sentence from one of the business use cases of an online music store.

“A customer clicks a button to add a CD to their shopping cart.”

In this case, candidate classes are customer, button, CD, and shopping cart.

The “Adjectives” option is incorrect. Adjectives describe nouns or pronouns and best represent properties of classes. If a portion of a requirements document for a racing game states that “All opponents’ vehicles will be blue”, the vehicle class will most likely have a color property and in this case be set to blue.

The “Verbs” option is incorrect. Verbs show actions or states of being and are usually representative of the methods that some of the classes will contain. Words contained in a requirements document or use case such as move, lift, or throw will be a good indication of some of the methods that will end up in your application.

The “Actors” option is incorrect. Actors are initiators of use cases but are external to the use cases that they are initiating. They may sometimes be represented as classes in your application, but a list of actors will never be a complete list of candidate classes.=================================================================================
6. You are a project manager hired to design an online shopping site for a new pharmaceutical company. You are creating use cases and use case diagrams for the purpose of extracting software requirements for the first iteration of development. After meeting with several domain experts, you come up with the following use cases:

Enter new product, login, order prescription, refill prescription, apply for job, pay bill, defer payment, and bill insurance.

Which use case diagram represents the BEST design of the software system (see Exhibit)?

Answer Explanation: Correct diagram is “A“.  A solid line with a triangular arrowhead represents the generalization relationship. The arrow runs from the more specific component to the more general. Since the “Pay bill with check” and “Pay bill with credit card” use cases are more specific forms of the “Pay bill” use case, it is best modeled in this manner. The “Check customer information” use case is utilized for both the “Refill prescription” and “Fill order” use cases. This situation is best modeled with an include relationship. The include relationship is represented by a broken line with an open arrowhead running from the base use case to the included use case.

The “B” option is incorrect. The extend relationship is much like the generalization relationship but is best used when the points of extension or extension rules are specified. Since there are no extension points specified in the “Pay bill” use case, it is not the best relationship to use. Also, since the “Check customer information” use case is not a more specific version of either the “fill order” or the “Refill prescription” use cases, it should not be represented with the generalization relationship.

The “C” option is incorrect. Since the “Pay bill with check” and “Pay bill with credit card” use cases are more specific forms of the “Pay bill” use case, they are best modeled with the generalization relationship.

The “D” option is incorrect. The extend relationship should not be used to link the “Check customer information” use case to the “Fill order” and “Fill prescription” use cases since it is not a more specific version of these use cases.===============================================================================7. You are a project manager for a team hired to develop an application for an insurance company to track fraudulent claims. You want to create a short list of people to interview for the purpose of developing use cases. From these use cases you will extract the requirements of the application.

Who are the best people to interview?ans: Senior employee and company manager
Answer Explanation: Use cases are narrative descriptions of the required system processes, using the language and terminology of the problem domain. Since they are created from the point of view of the domain experts for the purpose of determining functionality requirements, and are void of implementation details, no programming expertise is required to conceive use cases. Therefore, the most valuable information would come from these domain experts. A senior employee would provide valuable information regarding the needed functionality of the system and the company manager would make the primary decisions on which requirements are feasible with the time and budget allotted.

The “Lead developer” and “Object-oriented programming consultant” options are incorrect. Since implementation details or programming specifics are not included in use cases, the expertise that these professionals provide is of limited use.===============================================================================Objective: Dynamic Modeling
There are two types of iterative expressions, either a conditional or iterative execution.

Which of the following best describes an iteration, in relation to an iteration expression?

A representation of a condition
A representation of a sequence of messages
A representation of actions
A style of messages

Ans: A representation of a sequence of messagesAnswer Explanation: An iterative expression represents the execution of zero or more messages, depending on the conditions involved. The conditions of the clause in an iteration do not need to be specified. The iteration clause can either be expressed in a programming language or in pseudocode.

The option “A representation of a condition” is incorrect. A conditional clause is a representation of a condition. An iteration represents the sequence of messages.

The option “A representation of actions” is incorrect. An iteration does not represent actions. It represents the sequence of messages.

The option “A style of messages” is incorrect. An iteration represents the sequence of messages.=================================================================================Which of the following diagrams is an example of shared aggregation?

Answer Explanation: A shared aggregation relationship is specified with a hollow diamond at the component end of the relationship line. The multiplicity of the relationship can optionally be specified.

The “A” option is incorrect. A solid diamond signifies a composition or composition aggregation relationship. This relationship exists when a component can be part of only one composite at a time. An engine to car relationship would be an example of this.

The “C” option is incorrect. A hollow triangle arrowhead indicates a generalization relationship. This occurs when a class is a more specific form of another class. The arrow runs from the more specific to the more general class.

The “D” option is incorrect. An open arrowhead signifies an association relationship between classes. The direction of the arrow is the direction of navigability. The arrowhead can be omitted if the direction of navigability is either bi-directional or unknown.

==============================================================================Each option represents a simplified class diagram of a company’s employee tracker software (see Exhibit).

Which diagram displays the BEST use of multiplicity?

Answer Explanation: This diagram shows that a Company object can be associated with many Person objects through the Employment association class and a Person object can be associated with zero or one Company objects. A many-to-zero or one (* – 0..1) association is specified instead of many-to-one (* – 1) because it is possible for a company to have a record of, and therefore an association to, a person without that person being employed by the company.

The “a” option is incorrect. Association classes do not have multiplicity. If you create an association class that appears to need multiplicity, it would normally be better modeled as a distinct class.

The “b” option is incorrect. Association classes do not have multiplicity. If you create an association class that appears to need multiplicity, it would normally be better modeled as a distinct class.

The “c” option is incorrect. The Person-to-Company association of many-to-zero or one (* – 0..1) is better than a many-to-many (* – *) association, even though it is technically possible for a person to work for more than one company. Since this class diagram is in the context of an employee tracker application for a single company, it does not need to track associations of other companies.