Kalid's Math and Science Pages |
Home | Articles | Download | Fun | Links | About |
IntroductionAbstraction the technique of viewing the big picture and hiding the details. It is what allows you to make generalizations, by extracting the commonality of components and hiding their details. This site uses abstraction to come up with revelations. Later, the detatils can be added, but they are burdensome when just trying to understand an object. Abstraction is everywhere. When we look at a map, we draw roads and highways, not individual trees. Tiny details do not matter, and should be ignored for the sake of simplicity. Remember, this is not "dumbing down". Certain material would be confusing if included, so we drop it. We want the core ideas. Abstraction in DesignDetails are important in a design, but in the initial stages they only bog you down. With abstraction, you can break things into groups and figure out the details for each separately. Breaking a project into components allows you to see how the project works as a whole: it is a system of interrelated parts. Each component should be independent, so it does not depend on the details of others. One component may require the output of another, but it does not care how that output was created. This style allows you to change a component without affecting others. As long as you keep the output the same, the other components cannot tell. Thus, you can upgrade one part (if you find a better way of doing something) and keep the system intact. Abstraction organizes your project. Once you know what your component does, you can treat it as a "black box". This means you ignore its implementation details: all you know is that given certain inputs, it produces an output. You can then link these "black boxes" together to create your system. This high-level organization is easy to manipulate. Most projects can be improved with abstraction.
For example, take a car
This simple example shows you can change one component without changing the others. If you decide you want an electric engine, it should not effect your steering. Auto design is much more complicated than this, but abstraction allows you to view the picture (instead of first designing the windshield wipers). Disadvantages of AbstractionBecause abstraction hides details, it can be more inefficient than a high-level look. The details are important, and knowing every detail of every component can help you to make the "perfect" decision. Consider two maps:
If you want the absolute shortest path from A to B, you consult map 2, and spend a long time looking at every shortcut (and hoping you do not get lost on the way). If you just want to *get* from A to B, look at map 1 and figure it out in a reasonable time. The high-level approach allows you to get a working answer. Later, you can look at the second map and change your original path. But that is much easier than trying to start from map 2. What if point B changes? How easy is it to change your path? You can make a high-level design, then add in the low-level shortcuts later. Examples of AbstractionWe have the map example, which everyone should be able to relate to. More technical examples follow. Electric circuit diagrams are a great example. A battery is represented as two lines (one positive, one negative). The electrochemical reactions that take place inside ignored: the battery is a component that creates a potential difference. We don't care how Duracell managed this; as long as it outputs the voltage we want, we are happy. A new, cheaper battery is easy to add, because it doesn't change how the system works (our components are independent). Another example is computer programming. Certain languages make operations easy, while others require knowing very specific details (the high-level and low-level maps). C is very powerful, and with it you can create small, fast code. Perl/Java is higher-level, and thus slower, but you can make software very easily with those languages. They are not as fast, however. The choice of language depends on the application. One compromise is to outline the software in Java, and write the parts that need to go fast in C. ConclusionI hope you see that abstraction is very powerful, and is not "dumbing down". To the contrary, it allows you to design systems better than you would have if you examined every detail from the outset. The details and short-cuts can be added in later. Abstraction is the basis for many articles. Noticing the key high-level idea is the secret of success for many math and physics topics. It is easy to combine high-level ideas, so you can understand how complicated systems work by breaking them apart (such as a radio). Some key ideas
|