The BASE for JAVA LEARNING

by
PRO
FE S
S OR

A B S T R A C T I O N
AN OBJECT-ORIENTED FEATURE
Abstraction is a concept used in different phases in Object-Oriented Programming.
During the insertion phase of the Software Life Cycle:
-
Abstraction is used during the conceptual analysis phase to generate code more adaptable to future modifications.
-
Abstraction refers to Programming Conceptualization. This conceptuatlization takes into account:
- All the items necessary for the program implementation.
-
The programmer makes an assessment of the items of the system to use. Only those items necessary for the achievement of the programming goal are captured (that's the abstraction). All other non-relevant items are not used.
During the development phase of the Software Life Cycle:
-
While the code is being developed, an Abstraction can be used as a way of interfacing objects of different classes.
- Code can be programmed to an Abtraction.
As an example, let's say that we have three concrete classes: a Book class, a Manual class, and a Brochure class. All of these classes need to interface with objects of other classes. In order to facilitate the interface, we create an abstraction about these three classes. In this case, an abstraction can be a "Readable" interface, as instances of these three classes represent things that can be read.
When an outside class wants to interface with either the Book class, or the Manual class, or the Brochure class, it can do so by coupling with the "Readable" interface.
-
By the Abstraction feature, modifications and future interfaces of outside objects with any concrete class, can be implemented using an Abstraction (interface).
-
There is no need for the programmer to know about concrete classes, if he or she programs to the interface.
- Also if another concrete class has to be added in the future, (say the Magazine class to follow up on example above) it can be done with minimum changes to the existing code.