This site is 100% ad supported. Please add an exception to adblock for this site.

CSE 111


undefined, object
copy deck
What are the phases in the Waterfall Model?
Name the 4 iteration pahses of RUP.
C - Construction
I - Inception
T - Transition
E - Elaboration
approximate vision, business care, scope, vague estimates
refined vision, iterative implementation of the core archittecture, resolution of high risks, id of most requirements, more realistic estimates
iterative implementation of the remaining lower risk and easier elements and preparation for deployment
Beta Tests, deployment
What are the 9 RUP Phase Activities?
BM - Business Modeling
PM - Project Management
D - Design
D - Deployment
C & C - Configuration and Change
R - Requirements
I - Implementation
T - Test
E - Environment
What is Cohesion?
A measure of how strongly related and focused the responsbilities of an element are.
What is high cohesion?
An element with highly related responsibilities but doesn't do a lot of work
What is low cohesion?
A class that does many unrelated things
What are the 7 Levels of GENERAL Cohesion?
C - Coincidental
L - Logical
T - Temporal
F - Functional
P - Procedural
DF - Data Flow
C - Communicational
1) Coincidental (general cohesion):
accidental, no functional rationale; divy up of code into modules determined by size consideration; isolation of commonly used but not functionally related code
2) Logical (general cohesion):
Group things together that are the same kind of thing

Ex: Module containing al lthe error handling routines or initialization module that opens files, initializes variables, etc.
3) Temporal (general cohesion):
Group things together that can be done at the same time

Ex: initialization code
4) Functional (general cohesion):
everything in component works together to support a common, well defined function

Ex: function for computing "goodness" of a match in a complex DS
5) Procedural (general cohesion):
Group things together that will be part of the same computational structure (things that will be repeated inside a loop)
6) Data Flow (general cohesion):
group A, B, C together if A prepares data used by B which prepares data used by C

idea is that A,B,C must be part the same function
7) Communicational (general cohesion):
group things together that use the same data

Ex: routines for accessing DB in diff ways
What are the levels of class cohesion?
Very Low
Very Low (class cohesion):
class responsible for many things in very different functional areas
Low (class cohesion):
class responsible for many or complex things in 1 functional area
Moderate (class cohesion):
Class has light or moderate responsibilities for a few different areas that are related to class but not each other
High (class cohesion):
class has moderate responsbilities in one functional area, cooperaters w/ others to fulfill more complex responsibilities
What are the kinds of Class Coupling?
Strong - Class A is a subclass of class B

Moderate - Class A implements interface B

Weaker - A has an attribute (instance) var for objects of class B

A Class A method calls a Class B Method

A has a method that:
-returns items of class B
-has local vars of class B
-has param of class B
What is an expert pattern?
Assigns the responsibility to the class that has the info necessary to fulfill those responsibilities
What is the expert pattern also known as?
Do it to myself; put services w/ attributes they work on
What is object animation?
taking the things that you would normally do to an object and have it do it to itself
What is a creator pattern?
giving the responsibilitie of creating an instance of class A if:
1. B aggregates A objects
2. B contains A objects
3. B records instances of A objects
4. B closely uses A objects
5. B has the initializing data that will be passed to A when it is created
What is a controller pattern?
delegates responsibilities, doesn't do much work
What are the 4 types of controller patterns?
Use Case
System Controller:
Object representing system or subsystem.

Could be subsystem proxy or interface
Ex: option seletion dialog, set member data dialog in GUI subsystem
Business Controller:
Business is whole enterprise. DS is part of a personal services corporation.
Role Controller:
Roles is 1 of the actors in the system. Ex: DS Member controler or Admin Controller
Use Case Controller:
Good cohesion in that it can keep track of all events and enforce sequience and out of sequence issues
T/F: Stepwise Refinement is a strategy for transforming pseudo-code into code
T/F: "Top down" and "bottom up" refer to ways of positioning the menu bar on a Java Frame
T/F: Use cases are functional descriptions, rahter than object oriented descriptions
Within each RUP phase, there are nine phase activities. Four of these are the same as the most basic Waterfall Model. What are they?
Requirements, Design, Testing, Coding/Implementation
What does the FURPS Acronym stand for?
F - Functionality
U - Usability
R - Reliability
P - Performance
S - Supportability
What is class visibility?
Class A has an attribute var y of class B

Inlude the definition for class B inside class A

Ex: in DS, all of the GUI class defs are inner classes in GUI, which makes it possible to define instances of them
What is Global Visibility?
The object Y is made global to all classes so that all can reference it

Ex: The Message Dialog is used over and over in DS
File Visibility
A class in a file can access other class definitions in that file

Ex: in DS, the class definition for the message class file is included in the GUI class file. GUI is the public object
Package Visibility
THe classes in one file in a package can see public and non private classes in other files. Private classes in a file are not visibile outside the file.
Import Visibility
One file can declare itself to be a part of a name package

A file can import files in specified packages

Ex: in DS, GUI has param visibility to DL object that is passed to its constructor. GUI has visibility to the DL class via an import statement.
DL calls DB methods. How does it see/access the DB objects?
The database object is passed as a formal parameter (in the
constructor) and then set as an attribute value in domain logic.
DL is called on to give info about the currently logged on member. It keeps a LogOn object. How does it keep track of and access this LogOn object?
The LogOn object is the value of one of domainLogic's attributes (ie. class variable)
DL is called on to give info about the currently logged on member. It keeps a LogOn object. How is it able to access the LogOn class for this object, when and if it needs it?
LogOn class is an inner class of domainLogic, so domainLogic can see it.
What is a self-testing class and what is the basic feature ofthe design of such a class?
it has a main method that is used for testing

main method creates an instance of the class, calls class methods that change the state, calls class methods that verifies results of a test
Bottom Up Implementation
Start with the functions at the bottom of the design tree

Objects which receive messages but do not send them
Top Down Implementation
Start with the functions at the top of the design tree

Objects which send messages but do not receive them
Least-Coupled First
Easier to do than unit testing
Ex: LogOn class in DomainLogic
What is Unit Testing?
Test individual classes or small groups of classes during development
What is Test First Programming?
Write the class tests before the class
What is Functional Testing?
Use test scripts that describe a sequence of program interactions and behavior verifications for system testing
What are all the different kinds of UML Diagrams?

U - Use Case
C - Class
IS - Interaction Sequence
C - Collaboration
P - Package
A - Activity
D - Deployment
S - State
What is Generalization?
Used to indicate that one kind of classifier is a generalization of another, when applied to classes, similar to inheritance
What is a Subtype?
A subset of the instances of some classifier, having special properties of their own.

All members of a subtype set are members of a supertype set
What is a supertype?
More abstract classifier having common properties of subtypes. A supertype set contains all elements in subtype sets.
Give an example of an association.
FacultyInformation - CourseInformation
StudentInformation - CourseInformation
What are the Generalization Correctness Rules? (3)
1) is-a: An instance of a subtype is also an instance of the supertype

2) Substitutability: If B is a subtype of A, it should be possible to substitue an instance of B any place that requires something of type A

3) 100% rule: All of the supertype's definition should also apply to the subtype (ie its attributes and associations)
What is the aggregation correctness rule?
Has-a: The composite object has an instance of each class that it aggregates (part-of)
What is composition?
A Strong form of aggregation
-Parts only belong to one whole
-If whole is deleted, parts get deleted also
What do Activity Diagrams show?

What are their usefulness?
Similar to flow charts but also allow parallel processes.

Used as flow charts for algorithms, with or without use of parallel processing.

For system level, useful if there are intearacting parallel processes

Not that effective for system level object oriented descriptions w/ non parallel processing
Describe UML Deployment Diagrams.
Purpose: to show how software is distributed amongst hardware

Ex: Client-Server version of DS
What are the components of State Chart Models?
States: a condition of an object
Events: a state changing occurrence
Transitions: from one state to the next, occur when the associated event occurs
Messages in a DL diagram are sent from an object x to an object y. This is done when a method for x calls a method for y. In the case of the GUI design, as in the above (diagram), this is partly true but there is another way in which we use messages that
In GUI design, a message is also used to show an action of the user (ie.
button push, text entry). The message is not really a method being called.
What are 3 State Model Applications?
1) System specification and design
2) Class specification: shows the states an object can be in and how the transitions occur as the result of events. Events correspond to messages arriving (or values returned from messages being sent).
3) GUI Interface design
In GUI Interface Design, what do the following correspond to?

Current State
States = screens (Ex: LogOn, MemberOptions)

Current state = visible screen/dialog

Events = User Actions
What is a concurrent substate model?
it is a state chart in which every submodel has its own set of states, modeled by possible values of its state variable vector
What is a compound model?
It is a model in which states correspond to all possible combinations of states of submodels.
Compare Sequence Diagrams and State Diagrams
Sequence: used to id input forms for GUI, etc. Used to show a particular scenario.

State: merges scenarios into inclusive model. gives complete picture of order in which things can occur.
State Model Pitfalls:
1) Too Detailed
2) Badly drawn/organized
3) Not really a state model but a flow chart (states are actions and transitions are conditions on existing values, like a control flow diagram)
4) Transitions should be made on the occurence of events
What is a Contract?
It has a precondition which is what you assume to be true before and operation and a postcondition which is what you assert otb e true after an operation. The contract itself is that if the preconditions hold before, then the postconditions will hold afterwards.
What are the 2 kinds of postconditions?
1) Low level: conditions and relationships on variable values, return value props

2) Higher level: objects created or deleted, associations formed or deleted
What are contracts used for in programming algorithms?
They are formal specifications

They are proofs of correctness of the algorithms.
-verification, formal verification
What is a loop invariant?
It is an assertion about some state at some location in the loop
What is the partial correctness of A?
if A-one is true at the beginning of A and if A is executed and terminates, then A-en will be true at the end of the execution
What is the correctness rule for Contracts?
A is correct if it is partially correct, and it always terminates
What is the termination proof for the algorith discussed in class?
count initialized to x>=0, loop terminiates if count ==0, for each iteration Count is decremented by 1 so loop must terminitate
What are class invariants?
-They hold true after constructor, and true before and after each method application
-They could also document as pre and post conditions for each method to ensure compliance
What are some examples of class invariants?
-LogOn object created by DL when someon logs onto DS

-Has a class variable name which is never null-valued after LogOn is constructed (it is initialized in the constructor) ie. class invariant: {this.logOn != null}
What is a callback pattern?
It is when A gives B a pointer to one of its functions to call, or an object to execute, when a "special" situation occurs. This is when B has no control over A and B wants to initiate something that is under the control of A w/out taking control of A itself.
How are callbacks used?
Gui will call a method in DL (dl.function(gui)) passing in a Gui object. Gui must have an expected method gui.callback() that is known to DL and which will be called by DL when the callback situation arises. Gui must know the name of the method (dl.function()) in DL in order to call.
Describe the Publisher/Subscriber pattern.
There is a special event manager object.
Objects interested in an event, register w/ the event manager.
Objects who recognize the event, publish occurrence of event w/ the event manager.
Event manager informs subscribers
Describe the Observer/Observable pattern.
Observers (GUI) register w/ Observable (DL).
Observable recognizes event and calls specified method in observer.
What functions does the Observer class have? What kind of class is Observer?
Observer is an interface class which is implemented by observers.

It has an update method that Observable will call which is update(Observable x, Object y)
How is the Observable class implemented? What are its functions?
This class is extended by the callback caller classes (those who observe it)

Has addObserver(Observer z) which adds the object z to the observable's list of observers.

Has notifyObserver(Object y) which calls the update() method for each of the observers in its list of observers, passing y as the data object.
What is a singleton?
It is a class for which we only want a single instance, and to which we may want global access.
How is the singleton pattern implemented?
Create a single class variable called instance whose value is an instance of the object.

reference the object globally through its class definition.

create a static method called instance() that creates an instance if not created and returns an instance of the class.
What is a wrapper class?
You take an exisiting entity and alter its behavior or interface by embedding it inside a class
What are types of wrapper classes (2)?
A - Adapter: emphasis is on altering interface, but could add some additional responsibilities/behavior
D - Decorator - alters behavior or responsibilities but not interface
C - Combined
How is the Adapter Wrapper class implemented?
Via inheritance and composition.
Describe the Adapter inheritance strategy.
The adaptor class implements required new interface

extends adaptee with new methods for performing the adaptee responsibilities which conform to the new interface.
Describe the Adapter Composition strategy.
Adaptor class implementes the required new interface.

its constructor takes an adaptee object as an argument

its methods reference the adaptee object via its adaptee class methods
Describe the Window Listener Adaptor.
WindowListener is an interface that WindowAdaptor implements. Thus, you can extend the WindowAdaptor class and be able to override any WindowListener event such as windowClosing(), windowActivated(), etc.
When would you use a decorator class?
WHen you want to alter the run time behavior of an object.
T/F Subtypes can modify, add to, and access properties of supertypes
What are the 6 kinds of generalization?
S - Specialization
S - Specification
C - Construction
E - Extension
L - Limitation
C - Combination
Describe Specialization.
It is also known as refinement because it re-defines the defined parent properties and methods.
Describe Specification.
It is used to specify behavior, but not define it. Its subtype defines the behavior.
Describe Construction.
It is used for the purposes of re-use of methods and data structures. It defines new methods and data structures in terms of intherited ones. Ex: use of vector to define a class.
Describe Extension.
-adding new properties and methods with no modification of parent properties.

-similar to to construction but has the "is a" property. Ex: adding button declarations to the dialog class in a new extends class.
Describe Limitation.
-ovveride some methods with blank/null methods
-limits access to certain behaviors
Ex: WindowAdaptor class which is a limitation of WindowListener interface
Describe Combination. Give an example in the DS.
Uses multiple inheritance for two or more applications of generalization.

Ex: MessageDialog extends (i) Dialog implements (ii) ActionListener
(i) extension: add buttons, panels
(ii) specification: define actionPerformed method()
What is Polymorphism in terms of variables and methods?
A variable that can have values of different types
A method that can take arguments of different types
What are the 3 advantages to Polymorphic Design?
1) Subtypes encapsulate behavior alternatives for specification and documentation

2)Promotes cohesion and reuse

3) Follows the basic expert pattern
Describe the State pattern.
1) Suppose A:x is a state sensitive object
2) Define a corresponding state class S for A
3) Include a state variable S:s in A whose value will be an instance of the appropriate subtype of S
4) When a method x.m() in x is invoked, it executes s.m()
Give an example of a state pattern in the DS.
-Domain Logic subsystem has an interface class called DomainLogic.

-DomainLogic contains an inner class that defines a state class DomainLogicState

-DomainLogicState has subtypes for each type of user

-DomainLogic has a class variable called currentState that is set to an instance of a subtype of DomainLogicState
What is the Factory Pattern?
Involves a class that is used to create instances of one or more other classes. e.g. it will contain methods like: A: getInstanceofA()
which will create and return an instance of type A
As part of the motivation to use the factory pattern, why do we not just use the constructor for a certain class? Why use the factory pattern at all?
Since A is typically an interface or abstract class, the actual concrete class may not be known until runtime, via a run time property, and will be determined by the getInstanceA() method

The Concrete class known during class reuse

Also, Except for the factory, the code does not have to know what the concrete class is
What is Overloading Coercion?
It is when types of parameters are coereced to a standard type, which isn't ereally overloading.

ex: x*y is floating point for both integer and real numbers
what are the 2 main differences between factories and singleton?
1) the class of the returned instance is known in the code requesting it as a concrete class, not an interface or abstract class

2) the class of the returned instance is the same class as the place where the getInstance() method is located, it is not an instance of a different class
What are the 2 Framework Classes that allow for data abstraction?
1) DataBaseFramework (abstract class), createPersistentObject();

2) PersistentObject, an interface, used to specify the type of object returned by createPersistentObject()
What is are the difference between the DS Type 1 Factory and the DS Type 2 Factory?
Type 1 contains a create() method that is declared to return instances of an interface or abstract class, but actually returns instances of a concrete class.

Type 2 contains a create() method in a class that is abstract, and will be defined when the class is subclassed.
What is contained in the DataBaseFramework Class? What information does it have?
It is a factory pattern that has definitions for reading, writing and has PersistentObject[] p as a member.
What does the the DataBase create using the DataBaseFramework?
It creates a new MemberData which is a Persistent Object. MemberData is typed casted to the PersistentObject.
What does sthe PersistentObject Interface do?
defines methods for read, write, and key.
What information does a MemberData object have?
it has information about its own read and write methods and its members
What is the Bridge Pattern w/ respect to purpose and strategy?
Purpose: Decouple an abstraction from its implementation so that the implementation can be easily changed

Strategy: make the implementation details an object that is a component in the abstraction
What is the Composite Pattern w/ respect to purpose and strategy?
Purpose: build arbitrarily large, complex objects from simple parts.

Use recursion
What is the Flyweight Pattern w/ respect to Purpose and Strategy?
Purpose: large numbers of objects that simultaneously share a significant amount of information/internal state. Excessive storage needed for redundant information

Strategy: create a new class/object which the similar objects can share.
What is the Facade Pattern w/ respect to Purpose and Strategy?
Purpose: Provide a unified interface to a set of interfaces in a subsystem. Makes system easier to use, promotes low coupling, supports layering, re-use

Strategy: in the DS Example: the Business/Domain Logic and the DataBase subsystems have facade classes that serve as subsystem controllers and interfaces
What is the Proxy Pattern w/ respect to Purpose and Strategy?
Purpose: Provide a way to delay or ignore implementation considerations

Strategy: use a surrogate or placeholder for another object to control access to it

DS examples
DB virtual proxy (deferred construction). During the first phase of the DS we might build a virtual proxy for testing purposes, and substitute a real one later
What is the Pure Fabrication Pattern w/ respect to Purpose and Strategy?
Purpose: Collection of cohesive set of responsibilities with no domain concept

Strategy: Create an “artificial” object/class to take care of a responsibilities. Improves cohesion.

DS example: DomainLogic is the controller/interface class for the DomainLogic subsystem. No such concept in the problem domain
What is the Command Pattern w/ respect to Purpose and Strategy?
Purposes: Decouple knowledge of how to execute command from invoker of command

Strategy: encapsulate command as an object
What is the Iterator Pattern w/ respect to Purpose and Strategy?
Purpose: Iterate over a collection of objects without exposing its implementation structure

Strategy: An intermediate object is used that knows the implementation structure but presents an implementation independent iteration interface to clients
What is the Mediator Pattern w/ respect to Purpose and Strategy?
Purpose: Chaotic set of interactions between a set of objects/classes.

Strategy: Delink interactions between objects and make them pass through a single mediator object

Similar to Facade Pattern
What is the Visitor Pattern w/ respect to Purpose and Strategy?
Purpose: We have a collection of one or more operations to be performed on a collection of possibly diverse objects. We want to be easily able to add new operations without changing the classes of the elements it operates on

Strategy: remove the operations from the classes/objects and put them in a “visitor” that visits them, i.e. pass the function around to the data and have the data execute the appropriate version of the function
What is the Momento Pattern w/ respect to Purpose and Strategy?
Purpose: make it possible for an object to return to a previous state, by saving state in a memento object

object that might need to be rolled back supports a rollbackee interface
object that recognizes that a rollbackee object may need to be rolled back is a rollbacker subclass
rollbacker sends a getState message to rollbackee which returns a Memento object that is saved by the rollbacker
rollbacker sends a setState message to rollbackee with a Memento from which state can be restored
What is the Strategy Pattern w/ respect to Purpose and Strategy?
Purpose: to allow a program that uses variations of an algorithm to use the one that is appropriate to the variation of the application. Focus on time-space tradeoff differences rather than different functionality

Strategy: make the different algorithms instances of subclasses of the same interface class.
What patterns does the DS Example have?
Facade and Proxy for the DB class

Strategy for the idea of creating DL with different possible DB subtypes

Creator for who has the initializing information for DB
How do you convert Procedural Design to Objects in the Strategic Refactoring process?
Functional/Procedural Design
data is passed from one function to the next, which operates on it and returns data

convert data entities into objects
decompose behavior from functions
move behavior to objects
How do you separate domain from presentation in strategic refactoring?
1)create domain objects for each GUI window

2) move or duplicate domain oriented data in/to new domain objects

3) move domain oriented logic to new domain objects
Give an example of doman data that is moved to the Domain.
Name of admin that is used to determine user type
Give an example of domain logic moved to Domain
move all Database calls to domain logic
What is tactical refactoring: tease apart inheritance?
2 or more inheritance hierarchies involved

merged hierarchies have 2 different purposes

1) identify major hierarchy
2) extract subordinate hierarchy
3) create instance variable in common superclass
4) point to subordinate hierarchy
What is tactical refactoring: extract heirarchy process?
1) Create subclasses of the super class for each of the different kinds of behavior

2) Create a factory method for the superclass that returns an instance of the appropriate subclass

3)Change calls to the superclass constructor to the superclass factory method
Name the 2 Strategic Refactoring Examples
Convert Procedural Design to Objects

Spearate Domain From Presentation
Name the 2 Tactical Refactoring Examples
Tease Apart Inheritance

Extract Hierarchy

Deck Info