Java Reference
In-Depth Information
our programs to the real situations that the programs represent. That
is, the object-oriented approach makes it easier to solve problems,
which is the point of writing a program in the first place.
Let's discuss the general issues related to problem solving, and then
explore the specific characteristics of the object-oriented approach that
helps us solve those problems.
KEY CONCEPT
Object-oriented programming helps
us solve problems, which is the
purpose of writing a program.
Problem Solving
In general, problem solving consists of multiple steps:
1. Understanding the problem.
2. Designing a solution.
3. Considering alternatives to the solution and refining the solution.
4. Implementing the solution.
5. Testing the solution and fixing any problems that exist.
Although this approach applies to any kind of problem solving, it works par-
ticularly well when developing software. These steps aren't purely linear. That
is, some of the activities will overlap others. But at some point, all of these steps
should be carefully addressed.
The first step, understanding the problem, may sound obvious, but a lack of
attention to this step has been the cause of many misguided software development
efforts. If we attempt to solve a problem we don't completely understand, we
often end up solving the wrong problem or at least going off on improper tan-
gents. Each problem has a
problem domain, the real-world issues that are key to
our solution. For example, if we are going to write a program to score a bowling
match, then the problem domain includes the rules of bowling. To develop a good
solution, we must thoroughly understand the problem domain.
The key to designing a problem solution is breaking it down
into manageable pieces. A solution to any problem can rarely be
expressed as one big task. Instead, it is a series of small cooperating
tasks that interact to perform a larger task. When developing soft-
ware, we don't write one big program. We design separate pieces
that are responsible for certain parts of the solution, and then inte-
grate them with the other parts.
Our first inclination toward a solution may not be the best one. We must
always consider alternatives and refine the solution as necessary. The earlier we
consider alternatives, the easier it is to modify our approach.
Implementing the solution is the act of taking the design and putting it in a
usable form. When developing a software solution to a problem, the implementation
KEY CONCEPT
Program design involves breaking
a solution down into manageable
pieces.
 
Search WWH ::




Custom Search