Friday, November 23, 2007
Degree of Data Abstraction
Abstraction is the process of recognizing and focusing on important characteristics of a situation or object and leaving/filtering out the un-wanted characteristics of that situation or object.Lets take a person as example and see how that person is abstracted in various situations
A doctor sees (abstracts) the person as patient. The doctor is interested in name, height, weight, age, blood group, previous or existing diseases etc of a person
An employer sees (abstracts) a person as Employee. The employer is interested in name, age, health, degree of study, work experience etc of a person.
So, you see that Abstraction is the basis for software development. Its through abstraction we define the essential aspects of a system. The process of identifying the abstractions for a given system is called as Modelling (or object modelling).
In the above example, the doctor may not be interested in characteristics of a person on which the employer is interested in and vice versa. Both employer and doctor will not be interested in all the characteristics of a person (like the color of dress the person wears on a particular day, the food the person takes, the relatives of the person etc). But however some elements are common to both doctor and the employer (like name, age, height etc). This common element gives way to generalization. Ie, if we eliminate enough details of an abstraction, it become so generalized that it can be applied wide in range of situations.One good example for such a generalization is a cell. A generalized cell would look like
Though the above generalized cell doesnt look like a brain cell or muscle cell, the above can still be used to represent all cell types that have this common features.
In real world, there are millions of abstractions possible and many are complex in nature. The complexities of abstractions are handled by systematically classifying and generalizing the abstractions based on some pre-defined criteria. This process is known as classification. Classification builds up a hierarchy and its called as abstract hierarchy. You can see an example of an abstract hierarchy below .
So, we see that abstraction is the basis for object oriented programming. Abstraction serves as the foundation for determining the classes for a particular system (which is called object model). But be advised, there is no acid test to decide if the abstraction for a given system is right or wrong. A "person" abstraction for a hospital information system would be different from a person abstraction for a library information system and even with hospital information system, person abstraction may be different for different projects.
Once you have abstracted an object, it can be re-used. It can be modified to suit other situations. As a child you learnt Tri-cycle. You used the experience of learning tri-cycle (handle bar control, pedaling) to learn bicycling. What actually you do to learn bicycling is that you only learn to balance the bicycle while you use the experience of tricycle to use handlebar and pedaling. The same case applies to abstraction as well.
Though abstraction seems to be a simple concept, it’s a challenging task. The reasons are
There are un-limited numbers of possibilities to define an abstraction for a situation.
As mentioned earlier, there is no acid test to determine if the abstraction is right or wrong. You end up discussing, arguing with your counter part that yours is best and his is worst…. He does the same thing…
However, these problems are always addressed as you gain experience (which you can gain by reading more books/articles and doing real time projects) in defining the abstraction. Abstraction by itself is a huge and an interesting concept. But, I feel that most of the people, who define classes, do it without knowing what an abstraction is. Most of the times they are right. But doing your work with more knowledge (knowing what you are doing) lets you to enjoy.
Note: Characteristics of a situation or object may be seen (legs of a table) or unseen (smell of a food), felt or unfelt. This means that there is no specific definition for characteristics of a situation or object..
A doctor sees (abstracts) the person as patient. The doctor is interested in name, height, weight, age, blood group, previous or existing diseases etc of a person
An employer sees (abstracts) a person as Employee. The employer is interested in name, age, health, degree of study, work experience etc of a person.
So, you see that Abstraction is the basis for software development. Its through abstraction we define the essential aspects of a system. The process of identifying the abstractions for a given system is called as Modelling (or object modelling).
In the above example, the doctor may not be interested in characteristics of a person on which the employer is interested in and vice versa. Both employer and doctor will not be interested in all the characteristics of a person (like the color of dress the person wears on a particular day, the food the person takes, the relatives of the person etc). But however some elements are common to both doctor and the employer (like name, age, height etc). This common element gives way to generalization. Ie, if we eliminate enough details of an abstraction, it become so generalized that it can be applied wide in range of situations.One good example for such a generalization is a cell. A generalized cell would look like
Though the above generalized cell doesnt look like a brain cell or muscle cell, the above can still be used to represent all cell types that have this common features.
In real world, there are millions of abstractions possible and many are complex in nature. The complexities of abstractions are handled by systematically classifying and generalizing the abstractions based on some pre-defined criteria. This process is known as classification. Classification builds up a hierarchy and its called as abstract hierarchy. You can see an example of an abstract hierarchy below .
So, we see that abstraction is the basis for object oriented programming. Abstraction serves as the foundation for determining the classes for a particular system (which is called object model). But be advised, there is no acid test to decide if the abstraction for a given system is right or wrong. A "person" abstraction for a hospital information system would be different from a person abstraction for a library information system and even with hospital information system, person abstraction may be different for different projects.
Once you have abstracted an object, it can be re-used. It can be modified to suit other situations. As a child you learnt Tri-cycle. You used the experience of learning tri-cycle (handle bar control, pedaling) to learn bicycling. What actually you do to learn bicycling is that you only learn to balance the bicycle while you use the experience of tricycle to use handlebar and pedaling. The same case applies to abstraction as well.
Though abstraction seems to be a simple concept, it’s a challenging task. The reasons are
There are un-limited numbers of possibilities to define an abstraction for a situation.
As mentioned earlier, there is no acid test to determine if the abstraction is right or wrong. You end up discussing, arguing with your counter part that yours is best and his is worst…. He does the same thing…
However, these problems are always addressed as you gain experience (which you can gain by reading more books/articles and doing real time projects) in defining the abstraction. Abstraction by itself is a huge and an interesting concept. But, I feel that most of the people, who define classes, do it without knowing what an abstraction is. Most of the times they are right. But doing your work with more knowledge (knowing what you are doing) lets you to enjoy.
Note: Characteristics of a situation or object may be seen (legs of a table) or unseen (smell of a food), felt or unfelt. This means that there is no specific definition for characteristics of a situation or object..
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment