3 types of abstraction used in programming Watch
Have a look here: https://en.wikipedia.org/wiki/Abstra...puter_science)
The term 'abstraction' is synonymous with 'generalisation'. For example, the term 'Vehicle' is a generalised (abstract) term which could describe any number of different specific things - such as a Car, Truck, Bus, Train, etc. Cars, Trucks, Buses and Trains are all specialisations of a Vehicle. But, if you're using the term 'Vehicle' then you're probably using it in a context whereby you're not really bothered about specifying a Car or a Truck or a Bus. -- you might be using the term in a context where it could describe all of them; e.g. "A vehicle can travel from London to Bristol."
In programming terms, an abstraction is something that you might create using a programming language to represent a generalised concept related to whatever program you're trying to write.
If you've been programming for a while it's probably something that you're doing already and you don't even think about. Whenever you're thinking about all the different things that the program actually needs to do before you begin worry about exactly how it's going to work.
- A function which represents some kind of behaviour, such as sorting or searching a list of data (e.g. you might care that a "sort" function is able to sort the data, but the eventual result of a 'sort' function means it could have been correctly implemented using many different algorithms, including Bubblesort, Selection sort, Insertion Sort, Merge Sort, etc)
- A data structure which represents an entity in your system (e.g. a database table may have many rows which each represent a single real-world "thing", but the table itself is a generalised concept)
- A base class in object-oriented programming which may represent a generalised concept which is specialised by derived classes. e.g. with OO Programming you might write a base class which describes a 'DataReader' yet treat that class as a generalised concept if the program itself needed different kinds of data from different places; for example, derived classes such as TextFileDataReader or BinaryFileDataReader, or maybe even a DatabaseDataReader, etc.
The key to abstraction is to be able to describe a concept at a high-level, yet without going into the detail of "how does it work?". (You could think of it like 'selective ignorance').
If you're using any high-level programming language like Python, Java, C# or many others then just look at the built-in libraries for that programming language, there'll be tonnes of abstractions - i.e. all the named utilities which do 'useful' things - a lot of which could have been implemented in any number of different ways under-the-hood, but when you're using them in your program, you really don't care how they've been implemented, you merely care that they work and do their job.