Abstraction
Abstraction in software design is the practice of hiding unnecessary details and exposing only the essential features of a system. It helps simplify complex systems by focusing on what a component does rather than how it does it.
For example:
In Object-Oriented Programming (OOP), abstraction is achieved using classes and interfaces to define behaviors without revealing implementation details.
In DFDs, higher levels (like Level 0) show broad system functions, while deeper levels break them into detailed processes.
Abstraction improves clarity, maintainability, and scalability by reducing complexity and emphasizing key functionalities.
Example - User Authentication System
For example, when designing a user authentication system, you focus on what the system needs to achieve (e.g., verifying user credentials) rather than the intricate details of how passwords are stored and verified. By abstracting these details, you can streamline the development process and create a more efficient system.
The
authenticate_user
function focuses on the high-level goal of verifying user credentials without worrying about how this verification is done.The function
verify_credentials
handles the process of checking if the provided credentials match the stored ones, but it abstracts away the details of how passwords are retrieved and compared.get_stored_password
andcompare_passwords
are further abstractions that hide the details of how passwords are retrieved from storage and how they are compared.The
main
function represents the point where the authentication process is initiated, abstracting all the underlying complexity.
Define the high-level goal of the authentication system - the system needs to verify user credentials
Abstract the details of how credentials are verified into a separate function.
Abstract the retrieval of the stored password.
Abstract the comparison of passwords.
High-level function that calls authenticate_user and handles the result
Last updated