CpSc 372

Exam 2

Name______________________________________________

Answer any FOUR of the five questions. Place a large X on
the question you are omitting. If you answer all five, the one on which you
score the best will NOT be counted. All questions are counted the same: 25
points each. Answer all parts of each question.

You can not have a laptop in the exam. You may have the
class notes, handouts, copies of submitted homework. You have 75 minutes for
the exam.

Ecosystem,
Product Line

The
business view of STREAM identifies relationships between your
organization and others. For each of suppliers, buyers, potential
entrants, substitutes, and competitors explain what an organization could
do to protect itself against each category.

The
reusable asset team in a product line organization makes the assets so
that they are easily reusable. What steps does the team take to make an
asset more easily reusable?

For
each function in a program we define a pre-condition, post-condition, and
function invariant. What information does this give another programmer
who is going to use the function?

a.
Suppliers – maintain multiple suppliers

Buyers – diversify the customer base

Potential entrants – raise cost of
entry by lowering price and/or raising quality levels

Substitutes – add product features to
address their advantages

Competitors – collaborate with them

b.
Add variation mechanisms to that the asset can be
configured rather than modified; use abstractions from which specific instances
can be derived

c.
It tells the programmer what they must check for before
using the function and what they can expect after the function has returned a
value

architecture

The
singleton pattern ensures a single instance of a type is present in a
program. The usual implementation is a class which provides a pointer to
an instance of itself when asked to create a new one unless one does not
currently exist in which case it creates a new one. What design
principles does this represent?

The
Android SDK uses an Activity as the primary organizing principle. How
does this fit with the Model-View-Controller style typically used for
interactive applications?

The
architecture defines modules each of which can be specified using pre and
post conditions. In an AADL model which constructs are used to hold the
pre and post-conditions for each system?

a.
Encapsulation, information hiding

b.
Each Activity is an instance of MVC

c.
ports

Domain
specific, testing

Using
xText allows you to create a domain specific language
that is simpler and more specific than a general purpose programming
language. What benefit does that bring to the user of the language? What
does the user give up?

JUnit makes use of reflection. How? Reflection slows
the Java runtime because it takes memory and processor cycles. So what
does reflection give us in return that balances off that decrease in
speed?

AADL
allows us to build a machine-readable representation of the architecture
as we design it. What use is made of the AADL flow declarations in
creating test cases?

a.
The language uses terms closer to the user’s
domain of expertise. The language is not as broad as a general purpose language.

b.
Java uses reflection to locate the string “test”
in a method name and to write procedures to execute those methods. Reflection
gives some automation capability. The programmer need not spend time writing
tests. The runtime is also more flexible when we need tat
capability.

c.
A flow declaration gives the beginning and ending of a test
case.

Design

A proof
of correctness compares the specification for a function to what other
artifact? Why does this still not guarantee the product will work
correctly?

Fault
models guide the development of test cases but they can also guide the
design process. How can the fault model help determine the number of test
cases that should be created? What else helps determine how many tests?

We
have discussed waterfall, spiral, and iterative incremental process
models. How do they differ from each other? Give an example of when each
is useful.

a.
The proof must still be coded by a human in most cases which
is an opportunity for error to be inserted.

b.
There should be tests for each fault type plus the
severity of the fault type determines the level of coverage and thus number of
tests required. The control flow path and the number of unique paths through it
contribute to the number of tests needed.

c.
They differ in how development progresses through the
development activities and in exactly what those activities are. Waterfall
should be useful for a small routine project where the team has built similar
products (like an app). Spiral is good for a risk-driven project which may
combine some elements of research and development. The iterative, incremental
is good for larger more compelx projects that have
multiple teams coordinating their work.

State
machines, process

The
state machine abstraction is a mechanism for coordinating the work of
several functions that share common data. Explain how this description
relates to the definitions of transitions and states in the state
machine.

An
aspect is a powerful variation mechanism. Explain why it is so powerful
and give an example.

Consider
the 4 major phases of RUP: Inception, Elaboration, Construction, and
Transition. What is the role of design in each of these phases? List
example design activities for each phase and the objectives of each of
those activities.

a.
Each transition has a guard which is a Boolean function
and a trigger which is a function. It may have a side effect which is another
function.

b.
Aspects are powerful because there does not need to be
pre-existing hooks in the code waiting for the aspect and because the aspect
can be designed to be inserted at specific join points which are syntactic
places in the code.

c.
Inception – designers are looking for similar
designs in successful products to see how they were implemented

Elaboration – the design is actually
created

Construction – Code is written that
implements the design; conformance checking is carried out

Transition – feedback is evaluated to
determine the shortcomings of the design; faults also may be design faults and
all of this is fed into the next release