Abstraction
What is Abstraction?
Abstraction
The process of simplifying complex systems by focusing on essential details while ignoring irrelevant ones.
Abstraction allows us to manage complexity by creating generalised models that can be applied to various situations.
NoteAbstraction is not about removing details entirely, it's about selecting the right level of detail for a specific context.
Analogy- Think of abstraction like a blueprint for a house.
- The blueprint shows the structure and layout without detailing every nail or piece of wiring.
- It provides a high-level view that guides construction while leaving out unnecessary specifics.
It allows you to:
- Manage complexity: By breaking down a problem into smaller, more manageable parts.
- Enhance clarity: By highlighting the most important aspects of a problem or solution.
- Facilitate reusability: By creating generalised solutions that can be applied to multiple situations.
Abstraction is a fundamental concept in computer science, enabling us to manage complexity by breaking down problems into manageable parts.
ExampleA recipe abstracts the cooking process by listing ingredients and steps without detailing every minor action, such as opening a cupboard or turning on a stove.
Abstraction can be defined on different levels:
High-Level Abstraction: Focuses on the overall structure or purpose.
ExampleA school system represented as faculties and departments.
and Low-Level Abstraction: Focuses on specific details or implementation.
ExampleA department represented by courses and instructors.
Abstraction in Computer Science
In programming, abstraction is used to create models of real-world entities through data structures, algorithms, and object-oriented design.
Analogy- Think of abstraction like a map.
- A city map highlights roads and landmarks, ignoring unnecessary details like individual trees or buildings.
- Similarly, abstraction in computer science focuses on the essential features of a problem, ignoring irrelevant details.
Applications include, but are not limited to:
- Functions and sub-procedures:
- Algorithms often use abstraction to define high-level steps without specifying low-level operations.
- Pseudocode:
- Pseudocode is a form of abstraction that describes an algorithm's logic without adhering to the syntax of a specific programming language.
- Data Structures:
- Abstract data types (ADTs) like stacks and queues provide a high-level interface for data manipulation, hiding the underlying implementation details.
- Object-Oriented Programming: