CpSc 372
Exam 2 - Key
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 will need a picture ID to turn in your exam.
You can not have a laptop in the exam. You may have the textbook, class notes, handouts, copies of submitted homework. You have from 2pm until 3:15pm for the exam.
Abstraction allows details to be delayed until later when they are
better known. It also allows a design to be divided into smaller pieces to
reduce the complexity of each piece. UML allows models to have varying levels
of detail. Java supports abstraction by providing techniques such as
“interface” to separate specification from design.
|
Establish decision
criteria |
Pre: design goals
are set Post: criteria
established and prioritized |
Input: goals Output: criteria |
|
Identify design
options |
Pre: the context is
fully described Post: a candidate
set of options is created |
Input: a
brainstormed list of options Output: a refined
list of options |
|
Collect data |
Pre: sources of
design rules that can be used to quantify the options have been identified Post: each option is
evaluated for each criteria |
Input: design
knowledge and constraints on the current design Output: scores on
each option for each criteria |
|
Analyze and decide |
Pre: a complete set
of data is available Post: the single
best option is identified |
Input: data Output: a decision |
1. Each object shown in a sequence diagram must correspond to a class
shown in the class diagram/ each arrow in the sequence diagram corresponds to a
method defined in the class diagram
2. States are configurations of values of the attributes defined in the
class diagram; each transition between states corresponds to a method in one of
the classes.
3. The sequence of messages arriving at an object in a sequence diagram
must correspond to one path through the state diagram

The Listener pattern
is used in both cases. The MVC pattern is appropriate because it separates
functionally different behavior and reduces complexity thereby reducing
maintenance effort.
For the observer
pattern, “dirty” and “up to date” are the two main states. The object must be
displaying data to enter the dirty state. The object must have modified the
data it is displaying to enter the “up to date” state.
For the listener pattern,
“listening” and “event handling” are the two main states. The object must be
registered with some object to enter the listening state. The object must have
received some event in order to enter the event handling state.
M and V show loose
coupling by having public functions by which the two communicate with each
other. Each exhibits high cohesion by having a very specific responsibility in
the architecture.
The number and type of messages between two objects that are associated shows the level of coupling. The number of messages between an object and all of the objects it composes shows the degree of cohesion.
A
sequence diagram of the Model
/ View notify/update cycle would work for this.
Take each actor,
determine their level of experience, consider their entire set of uses, and
design controls that are appropriate.
|
Identify the
responsibilities |
Pre: requirements
have been reviewed Post: all
requirements are covered by some responsibility |
Input: requirements Output: set of
responsibilities |
|
Identify design
patterns that address the constraints on the design |
Pre: a catalog of
patterns is available Post: selections
have been made |
Input: all design
constraints and product responsibilities Output: selected set
of patterns |
|
Use the patterns to
distribute responsibilities |
Pre: patterns are
available Post: the monolithic
design has been decomposed |
Input: the patterns
and the responsibilites Output: a design
that has several pieces, each of which has responsibilities |
|
Validate the design |
Pre: design has been
completed Post: design
satisfies constraints |
Input: a tentative
design Output: list of
design defects |
We begin design by
first looking at the requirements, which specify function. Once we have that
incorporated then we worry about the user experience.
The plug-in.xml file supports the C portion of MVC the most. It allows
you to define new menus, editors, etc. MVC supports this by isolating into C
those aspects that are likely to be platform dependent. This is appropriate
because we are more likely to want to change the user experience from one
version to another than change the definition of an orthogonal array.
The extension points
and use of dynamically interpreted XML encourage loose coupling. The “editor
extension point” supports the addition of editors. The partitioning of
responsibilities into small plug-ins supports maintainability.
public ProblemArray(){
InputDialog id = new InputDialog(window.getShell(), "OATS Configuration","Enter Number of Factors", "0",null);
id.open();
numFactors = new Integer(id.getValue()).intValue();
for(int i=0;i<numFactors;i++){
id = new InputDialog(window.getShell(), "OATS Configuration","Enter Name for factor "+i, "0",null);
id.open();
name = id.getValue();
vectorOfNames.add(name);
id = new InputDialog(window.getShell(), "OATS Configuration","Enter
Number of Levels for factor "+i, "0",null);
id.open();
item = new Integer(id.getValue()).intValue();
vectorOfLevels.add(new Integer(item));
}
}
This
constructor combines representing a problem array and interface issues. The
interactive portion should be in one class and the representation of the
problem array in another.
Each
array was wrapped in another object that added the ability to be displayed to
the basic array class. It was implemented by subclassing
the basic array class to define the decorator and then having the decorator
aggregate an instance of the basic array class.
We used the factory pattern because this abstracts the availability of
a particular set of behavior from exactly which class provides it. Client
classes do not invoke the constructor directly, rather
they call a method whose implementation calls the constructor on some class
(which may change over time).
Goal: To complete an assigned
project
Questions:
1.
How much of
the work has been done?
2.
How much of
the allotted time has past?
Metric:
1.
% of modules
that have been developed
2.
compare % of
modules completed to the % of time that has elapsed