Dale - Computer Science Illuminated 195

Dale - Computer Science Illuminated 195 - card and responds...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
168 Chapter 6 Problem Solving and Algorithm Design Figure 6.8 A scenario walk-through in progress distinction is both subtle and profound. The final code for the calculation may look the same, but it is executed in different ways. In a program based on a top-down design, the program calls the subprogram that calculates the gpa, passing the student object as a parameter. In an object-oriented program, a message is sent to the object of the class to calculate its gpa. There are no parameters because the object to which the message is sent knows its own data. The name for this phase gives a clue as to how to go about assigning responsibilities to classes. The team uses play acting to test different scenarios. Each member of the team plays the role of one of the classes. Scenarios are “what if” scripts that allow participants to act out different situations. When a class has been sent a message, the actor holds up the CRC
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: card and responds to the message, sending messages to others as needed. As the scripts are being acted out, missing responsibilities are unearthed and unneeded responsibilities are detected. Sometimes the need for new classes surfaces. Although waving cards in the air when you are active may be a little embarrassing at first, team members quickly get into the spirit of the action when they see how effective the technique is. See Figure 6.8. The output from this phase is a set of CRC cards representing the core classes in the problem solution. The responsibilities for each class are listed on the card, along with the classes with which a responsibility must collaborate. Responsibility Algorithms Eventually, the algorithms must be written for the responsibilities. Because of the process of focusing on data rather than actions in the object-...
View Full Document

Ask a homework question - tutors are online