CpSc 372
Exam 2
Name:_______________________________________________
Answer any FIVE of the six questions. All questions count the same - plus/minus 20 points.
Forward engineering is useful in almost every project. It is useful whenever code is to be developed "from scratch."
Reverse engineering is useful when you must understand a piece of existing code for which no design documentation is available.
Roundtrip engineering is useful after most of the design has been completed and you ar making changes during debugging.
Forward engineering is a series of steps moving forward from gathering the requirements for a system through design, coding and system test that is repeated until the system is delivered.
Reverse engineering moves in reverse from code to design representation. It begins with parsing the code and building a representation for the code, usually a graphical representation. The developer then takes the output from the reverse engineering step and studies the representation to perform the needed analysis.
Roundtrip engineering combines forward and reverse engineering. The engineer begins the construction of a product in forward motion gathering requirements and moving through the steps. Once these steps have been accomplished, as errors are discovered, the code is repaired and the representation is updated.
Forward engineering is supported by tools that allow the engineer to build the graphical representation of the product being constructed. These tools integrate a code editor, automatically generate makefiles and compile the product. They provide an environment in which the product can be executed normally or in debug mode.
Reverse engineering tools include parsers and analyzers that read specific programming languages and build the structure of the code in a design representation. The tool includes an editor in which the representation can be examined and modified.
Roundtrip engineering tools essentially combine the facilities of both the forward and reverse engineering tools.
Pre: switch > 10
boolean A.chooseOption(int switch);
Post: if switch <= 20 return true;if switch >20 and switch <= 50 return false otherwise throw exception
Test case 1 - switch = 11 returns true
Test case 2 - switch = 19 returns true
Test case 3 - switch = 20 returns true
Test case 4 - switch = 21 returns false
Test case 5 - switch = 49 returns false
Test case 6 - switch = 50 returns false
Test case 7 - switch = 51 throw exception
Test case 8 - switch = 9 throw exception
Test case 9 - switch = 10 throw exception
The code
Test script class
Test case class

The test case class inherits from either the GenericTestHarness or from the test class for its parent class.

Use cases are identified by identifying actions of the system (verbs). Begin by identifying actors. Then for each actor, identify the uses made of the system by that actor.
The emergency worker generates a special key event by inserting the emergency key and turning it. The system responds by sending the car directly to the first floor if the car is heading down. The system first stops the car if it is heading up and then sending it to the first floor.
Classes are identified by looking for concepts (nouns). As each class is defined, new classes are identified from the attributes and actions of those classes.

Each visitor class will be looking for a specific security problem.

Extensibility to add new rules
Modifiability to correct problems with rules
The user would have to be able to recompile the code in order to use aspects