I am trying to understand the definition of 'abstraction' in OOP.
I have come across a few main definitions. Are they all valid? Is one of them wrong? I'm confused. (I re-wrote the definition with my own words).
Abstraction is the concept of taking some object from the real world, and converting it to programming terms. Such as creating a
Human class and giving it
String name, etc. properties, and
eat() etc. methods.
A more general definition. Abstraction is a concept that takes place anywhere in a software system where 'making things more general/simpler/abstract' is involved. A few examples:
An inheritance hierarchy, where the higher classes are simpler or more general, and define more general and abstract implementation. While the lower classes in the hierarchy are more concrete and define more detailed implementations.
Using encapsulation to hide the details of implementation of a class from other classes, thus making the class more 'abstract' (simpler) to the outside software world.
Another general definition: Abstraction is the concept of moving the focus from the details and concrete implementation of things, to the types of things (i.e. classes), the operations available (i.e. methods), etc, thus making the programming simpler, more general, and more abstract. (This can take place anywhere and in any context in the software system).
It takes place for example when encapsulating, because encapsulation means to hide the details of implementation and only show the types of things and their more general and abstract definitions. Anotehr example would be using a
List object in Java. this object actually uses the implementation details of an
ArrayList or a
LinkedList, but this information is abstracted using the more general name
Is any of these definitions correct? (I am referring to the most conventional and accepted definition).