抽象

来自iCenter Wiki
跳转至: 导航搜索

The notion of abstraction, central to many arts and sciences, is normally taken to be a mental expression that seeks to separate in thought, and capture in some concise manner, the essence of some entity. In computer science, we take the notion of abstraction very concretely, defining it to be a statement of ‘‘what the entity does’’ and ignoring the details of ‘‘how it does it.’’ This functional description must capture all that needs to be known in order to use the entity’s services, and nothing more. All the work, cleverness, information, and drama that went into the entity’s implementation are concealed from the client who is supposed to use it, since they are simply irrelevant. The articulation, use, and implementation of such abstractions are the bread and butter of our professional practice: Every hardware and software developer is routinely defining abstractions (also called ‘‘interfaces’’) and then implementing them, or asking other people to imple- ment them. The abstractions are often built layer upon layer, resulting in higher and higher levels of capabilities.

一般所谓抽象概念,是作为表达思想的方式,将事物本质性的东西从思维上独立出来,以求用概括的方式来把握事物。而在计算机科学领域里,我们将抽象的概念定义得非常具体,认为它是关于“事物要做什么”的概念,而不用考虑“如何来做”。这种功能性定义必须包含足够的信息以便使用该事物能够提供的服务。事物在实现中的所有内容(包括技巧、内部信息、精妙之处等),都对要使用该事物的客户隐藏起来,因为这些与客户并没有关系。对于所要进行的专业实践而言,我们就需要建立、使用并实现这种抽象。硬件和软件开发者都会定义抽象(也称为“接口”,interfaces),然而进行实现或留给其他人来实现。抽象通常是分层构建(一层构建在另一层之上),从而形成了越来越高层级的抽象能力。