NEW: For a prettier blog interface, see the Wordpress version!

Background

A newly-hired programmer/analyst at a large software company, you have been assigned to a small inventory management project. As the new kid on the block, you are in charge of double-checking the project design against the client's specifications. You are not supposed to change the project design on your own. Rather, you are expected to come up with a list of differences between the current design and the client's requirements. With your recommendations, the project team can decide what the best course of action is.

It's a rather daunting task, to say the least. The project documentation looks like it was done by a bunch of fresh graduates from some unnamable school who were so eager to start coding that they made a number of careless mistakes. With a sigh, you start by checking the use cases against the project description.

Part 1: Use cases

Project description: Elevator controller

Users outside an elevator can request an elevator going either up or down by pressing the appropriate buttons found on each floor. The button press will forward the request to the main elevator controller, and the nearest elevator going in that direction that can visit that floor will process the request. If no elevators are moving, then the nearest elevator that can visit that floor will answer the request.

Users inside an elevator can select a floor, keep the elevator doors open, or close the elevator doors. The buttons for each floor light up as they are selected and can be disabled or enabled. The elevator will not move if the door is open. The doors will not close if the elevator is overloaded. If the elevator is not overloaded and the door sensors have not triggered for a certain period of time, then the doors will automatically close.

Technicians can enable or disable elevators, up and down buttons, and the selection of particular floors from the elevator's inside panel. Technicians can command the elevator to move to a particular floor or open or close its doors. They can also configure the elevator (overload limit, time before door closes automatically). The technician cannot perform the usual user tasks from the technicial control panel. The technician's interface is physically secured (lock and key) so login is not needed.

Use cases: (correct)

User outside an elevator ------------------ UC01 Request an elevator going up

------------------ UC02 Request an elevator going down

User inside an elevator ------------------ UC03 Select a floor

------------------ UC04 Open the elevator doors ------------------ UC05 Close the elevator doors

Technician -------------------------------- Enable/disable a floor

-------------------------------- Enable/disable an elevator -------------------------------- Enable/disable an up or down button for a floor -------------------------------- Command elevator to move to a floor -------------------------------- Command elevator to open or close doors -------------------------------- Configure elevator

Use cases: (wrong)

User outside an elevator ------------------ UC01 Request an elevator going up

------------------ UC02 Request an elevator going down ------------------ UC03 Select a floor (inherits from ^) User inside an elevator ------------------ UC04 Open the elevator doors ------------------ UC05 Close the elevator doors (inherits from ^) Technician -------------------------------- UC06 Enable/disable a floor -------------------------------- UC07 Enable/disable an elevator -------------------------------- UC08 Enable/disable an up or down button for a floor -------------------------------- UC10 Configure elevator (inherits from ^) Superman -------------------------------- UC11 Save the world


Instructions: Identify specific discrepancies between the case description and the use cases. Write your answers as a bullet-point list. Example:

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

Part 2: Use cases and class diagrams

This test will help you evaluate your ability to ensure that all your client's functional requirements have been accounted for in the system design.

You've run a pretty nifty tool that took all the source code Here is the current class diagram for the system.

Correct:

Button ------------------------------- enabled : boolean selected : boolean floor : int label : String ------------------------------- press()

FloorButton : Button ---------------------------- goingUp : boolean ----------------------------

ElevatorButton : Button ---------------------------- elevator : Elevator

Floor ---------------------------- up : Button down : Button ----------------------------

Elevator ---------------------------- elevatorID : int buttons : Button[] currentFloor : int direction : int // 1: going up, -1: going down, 0: not moving doorsOpen : boolean enabled : boolean currentWeight : double weightLimit : double doorTimer : Timer secondsToWait : int ---------------------------- openDoor() : void closeDoor() : void move() : void move(floor : int) : void timedOut(timer : Timer) : void selectFloor(int floor) : void weightChanged() : void doorObstructed() : void ----------------------------

ElevatorController ---------------------------- elevators : Elevator[] floors : Floor[] ---------------------------- processRequest(button : FloorButton) : boolean getElevator(elevatorID : int) : Elevator

Timer ---------------------------- secondsLeft : int elevator : Elevator ---------------------------- start() : void reset() : void cancel() : void

Wrong:

Button ------------------------------- enabled : boolean selected : boolean floor : int label : String ------------------------------- press()

FloorButton : Button ---------------------------- goingUp : boolean ----------------------------

ElevatorButton : Button ---------------------------- elevator : Elevator

Floor ---------------------------- up : Button down : Button ---------------------------- openDoors() closeDoors()

Elevator ---------------------------- elevatorID : int buttons : Button[] currentFloor : int doorsOpen : boolean currentWeight : double doorTimer : Timer secondsToWait : int ---------------------------- openDoor() : void closeDoor() : void move() : void move(floor : int) : void timedOut(timer : Timer) : void selectFloor(int floor) : void getFloor(int floor) : floor weightChanged() : void doorObstructed() : void ----------------------------

ElevatorController ---------------------------- elevators : Elevator[] floors : Floor[] ---------------------------- processRequest(button : FloorButton) : boolean findBestElevator(buttor : FloorButton) : Elevator getElevator(elevatorID : int) : Elevator getFloor(floor : int) : Floor

Timer ---------------------------- secondsLeft : int elevator : Elevator ---------------------------- start() : void reset() : void cancel() : void

Instructions: Identify specific errors or discrepancies between the

use case diagrams and the class diagrams. You can make changes on the diagram or describe your changes as a bulleted list.

Example:

Notes:


As a starting programmer, you will usually be assigned to maintenance (reading and modifying other people's programs) or testing. Being able to read UML diagrams will help you greatly, as you'll be able to use the overall picture that the system designers created instead of getting lost in the details. This test will help you evaluate your ability to find out how code differs from the initial design and prepare recommendations for improvements.

public class FloorButton extends Button {

public void press() { if (!this.selected) { FloorController.processRequest(this); this.selected = true; } } // lots of code here }

public class ElevatorController {

public void processFloorRequest(FloorButton b)

{

Elevator best = this.findBestElevator(b);

best.selectFloor(b.floor);

} // lots of code here }
Previous day | Next day

I'd love to hear about any questions, comments, suggestions or links that you might have. Your comments will not be posted on this website immediately, but will be e-mailed to me first. You can use this form to get in touch with me, or e-mail me at [email protected] .

Page: Uml Test
Updated: 2004-11-21
NOTE: ANTI-SPAM MEASURE NOW IN PLACE. Please answer the following question with the right number in order to send me your comment.
What is two minus one? (hint: one ;) )
Name:
E-mail:
URL:
Comments: