Programming and Problem Solving with Java

(やまだぃちぅ) #1
Summary | 315

2.During brainstorming, don’t try to filter ideas while they are being generated.
It is the free flow of ideas that often produces the most innovative
approaches.
3.If you are developing a design by yourself, wait to start filtering until the next
day, or at least after a few hours of doing something different. It takes some
mental distance to give the necessary perspective for successful filtering.
4.Pick a simple initial scenario, and then work your way into the more complex
scenarios. Otherwise, the number of new classes that you have to create
initially can be overwhelming.
5.Don’t hesitate to write down additional useful information that is identified
during the scenario walk-throughs. At the same time, don’t get bogged down
in writing responsibility algorithms during the walk-through process.
6.Use the package level of access for each data field unless your design specifi-
cally calls for it to be publicor private.
7.Store multifile packages in the same directory. Otherwise, you will get an
error message saying that the classes in the package can’t be found.

Summary


Object-oriented design (OOD) and functional decomposition are methods for
tackling nontrivial programming problems. The two methodologies are often used in
combination, and experienced programmers often switch back and forth between
them in solving a problem. We use OOD to design the overall solution to a complex
problem, and then apply functional decomposition to aid in writing the algorithms
for the individual responsibilities of each object.
Object-oriented design produces a problem solution by focusing on objects, their
associated operations, and their interactions. The first step is to identify the major ob-
jects in the problem and create classes that are abstract descriptions of them. Next, we
filter the initial classes, eliminating duplicate and inappropriate classes. We then walk
through a series of scenarios, working from common cases to exceptional cases to de-
termine the responsibilities and collaborations of the classes. The use of CRC cards
helps us to keep track of this information as we explore the scenarios. The result of
this process is a design consisting of self-contained objects that have responsibilities

Free download pdf