» 抽象(OOP编程)

抽象(OOP编程)

1970
  • Barbara Liskov
Software engineer coding abstract classes in a modern IDE environment.

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 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 方法 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.

UNESCO Nomenclature: 1203
- 计算机科学

类型

抽象系统

中断

基础

使用方法

广泛使用

前体

  • 数学抽象
  • 子程序和函数的概念作为一种程序抽象的形式
  • 抽象数据类型(ADT)理论
  • 需要管理大型工程项目的复杂性

应用

  • 隐藏特定 SQL 查询的数据库访问层 (DAL)
  • 设备驱动程序从操作系统中抽象出硬件复杂性
  • graphical user interface (图形用户界面) libraries providing high-level widgets
  • HTTP 等网络协议抽象了底层 TCP/IP 通信
  • C++ 中的标准模板库 (stl)

专利:

NA

潜在的创新想法

级别需要会员

您必须是!!等级!!会员才能访问此内容。

立即加入

已经是会员? 在此登录
Related to: abstraction, interface, abstract class, API, information hiding, complexity, OOP, contract, decoupling, modularity.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

迎接新挑战
机械工程师、项目、工艺工程师或研发经理
有效的产品开发

可在短时间内接受新的挑战。
通过 LinkedIn 联系我
塑料金属电子集成、成本设计、GMP、人体工程学、中高容量设备和耗材、精益制造、受监管行业、CE 和 FDA、CAD、Solidworks、精益西格玛黑带、医疗 ISO 13485

我们正在寻找新的赞助商

 

您的公司或机构从事技术、科学或研究吗?
> 给我们发送消息 <

接收所有新文章
免费,无垃圾邮件,电子邮件不分发也不转售

或者您可以免费获得完整会员资格以访问所有受限制的内容>这里<

历史背景

(如果日期不详或不相关,例如 "流体力学",则对其显著出现的时间作了四舍五入的估计)。

相关发明、创新和技术原理

滚动至顶部

你可能还喜欢