Abstraction in OOP is the concept of hiding complex implementation details and showing only the essential features of the object. It focuses on what an object does instead of how it does it. This is achieved through abstract classes and interfaces, which define a blueprint for other classes without providing a complete implementation, simplifying complex systems.
Abstraction (OOP programming)
- Barbara Liskov
Abstraction is a process of managing complexity. In programming, it involves creating a simplified representation of a system or component. In OOP, this is primarily done using abstract classes and interfaces. An abstract class is a class that cannot be instantiated on its own and is meant to be subclassed. It can contain abstract methods (methods without a body) that subclasses must implement. An interface is a similar concept but is purely abstract; it can only define méthode signatures, not implementations. A class can then ‘implement’ an interface, promising to provide the functionality defined in it.
This allows programmers to define a common contract or API that multiple different classes can adhere to. For example, an interface ‘Storable’ could define ‘save()’ and ‘load()’ methods. Different classes like ‘Document’, ‘Image’, and ‘UserSettings’ could all implement the ‘Storable’ interface, each providing its own logic for saving and loading. Code that works with ‘Storable’ objects doesn’t need to know the specific type of object it’s dealing with; it only needs to know that it can call ‘save()’ and ‘load()’. This decouples the client code from the specific implementations, making the system more modular, flexible, and easier to understand at a high level.
Taper
Perturbation
Usage
Précurseurs
- mathematical abstraction
- the concept of subroutines and functions as a form of procedural abstraction
- abstract data types (adt) theory
- the need to manage complexity in large-scale engineering projects
Applications
- database access layers (DALs) that hide the specific SQL queries
- device drivers abstracting hardware complexity from the operating system
- graphical interface utilisateur (GUI) libraries providing high-level widgets
- network protocols like HTTP abstracting the underlying TCP/IP communication
- the standard template library (stl) in C++
Brevets:
Idées d'innovations potentielles
!niveaux !!! Adhésion obligatoire
Vous devez être membre de l'association pour accéder à ce contenu.
DISPONIBLE POUR DE NOUVEAUX DÉFIS
Ingénieur mécanique, chef de projet, ingénierie des procédés ou R&D
Disponible pour un nouveau défi dans un court délai.
Contactez-moi sur LinkedIn
Intégration électronique métal-plastique, Conception à coût réduit, BPF, Ergonomie, Appareils et consommables de volume moyen à élevé, Production allégée, Secteurs réglementés, CE et FDA, CAO, Solidworks, Lean Sigma Black Belt, ISO 13485 médical
Nous recherchons un nouveau sponsor
Votre entreprise ou institution est dans le domaine de la technique, de la science ou de la recherche ?
> envoyez-nous un message <
Recevez tous les nouveaux articles
Gratuit, pas de spam, email non distribué ni revendu
ou vous pouvez obtenir votre adhésion complète - gratuitement - pour accéder à tout le contenu restreint >ici<
Inventions, innovations et principes techniques connexes