Abstract
- Decouple the nitty-gritty lower level details from the higher level implementation, achieving ease of use
Control Abstraction
- We focus on results, not the process. Just give us the inputs, and we’ll handle the rest.
- Function is a form of abstraction over computation
Data Abstraction
- The states/data that is hidden away from us but is used during the processing
- Variable is a form of abstraction over data
Abstraction Barrier
- Features and the associated data are grouped in a container aka module
- Providing an interface for other modules to interactive with
Important
Granting full access to features and data behind the abstraction barrier should be reserved for users with a well-justified reason. Doing so can lead to a breach of the abstraction barrier itself. If a user builds their product using this data directly, it can make it difficult for us, the implementers, to modify the data without causing disruptions to the user’s product.
Changes made to the modules are limited
Changes made within the module don’t require other modules to get modified, as long as the exposed interface is unchanged.
Easier to build on top
Abstraction allows us to use a set of concepts without the need to know the nitty gritty.
Reduced Flexibility
If we want to modify the features protected by the abstraction barrier. We need to get the one who implemented the nitty gritty to help us. This can be helped with Code for Change.
Programming Abstraction
- Layer 1. Instruction
- Layer 2. Assembly language
- Layer 3. C
- Layer 4. Even high-level languages like Python