Section 5.9. Problem Solving Representation Action


[Page 236 (continued)]

5.9. Problem Solving = Representation + Action

As you have seen in this chapter, designing classes involves a careful interplay between representation (data) and action (methods). Our several modifications to the OneRowNim class illustrate that the data used to represent an object's state can either complicate or simplify the design of the methods needed to solve a problem.

We hope that it is becoming clear to you that in writing object-oriented programs, choosing an appropriate data representation is just as important as choosing the correct algorithm. The concept of an object allows us to encapsulate representation and action into a single entity. It is a very natural way to approach problem solving.

If you look closely enough at any problem, you will find a close relationship between representation and action. For example, compare the task of performing multiplication using Arabic numerals (65 * 12 = 380) and the same task using Roman numerals (LXV * XII = DCCLXXX). It's doubtful that science and technology would be where they are today if our civilization had to rely forever on the Roman way of representing numbers!

Effective Design: Representation and Action

Representation (data) and action (methods) are equally important parts of the problem-solving process.





Java, Java, Java(c) Object-Orienting Problem Solving
Java, Java, Java, Object-Oriented Problem Solving (3rd Edition)
ISBN: 0131474340
EAN: 2147483647
Year: 2005
Pages: 275

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net