Section 6.1. Creating Models


6.1. Creating Models

Humans are model-builders. We create models of the world to manage complexity and to help us understand problems we're trying to solve. You see models all the time. Maps are models of roadways . Globes are models of the Earth. Atomic models are models of the interaction of subatomic particles.

Models are simplifications . There is little point to a model that is as complex as the object in the problem domain. If you had a map of the United States that had every rock, blade of grass, and bit of dirt in the entire country, the map would have to be as big as the country itself. [*] Your road atlas of the U.S. eschews all sorts of irrelevant detail, focusing only on those aspects of the problem domain (such as the country's roads) that are important to solving the problem (getting from place to place). If you want to drive from Boston to New York City, you don't care where the trees are; you care where the exits and interchanges are located. Therefore, the network of roads is what appears in the atlas.

[*] Steven Wright joke: "I have a model of the United States. One inch equals one inch. I live at E5."

Albert Einstein once said: "Things should be made as simple as possible, but not any simpler." A model must be faithful to those aspects of the problem domain that are relevant. For example, a road map must provide accurate relative distances. The distance from Boston to New York must be proportional to the actual driving distance. If one inch represents 25 miles at the start of the trip, it must represent 25 miles throughout the trip, or the map will be unusable. [ ]

[ ] Okay, not strictly true. When you flatten a globe into a map, something has to be distorted . The Mercator projection represents the lines of longitude as straight vertical lines, at the cost of grossly distorting size near the poles, and thus are of use to their intended audience (sailors). Unfortunately, these maps are ubiquitous in school rooms, leading generations of children to believe that Greenland is bigger than the United States (when, in fact, the U.S. is more than four times as large).

A good object-oriented design is an accurate model of the problem you are trying to solve. Your design choices influence not only how you solve the problem, but in fact they influence how you think about the problem. A good design, like a good model, allows you to examine the relevant details of the problem without confusion or distraction.



Learning C# 2005
Learning C# 2005: Get Started with C# 2.0 and .NET Programming (2nd Edition)
ISBN: 0596102097
EAN: 2147483647
Year: 2004
Pages: 250

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