抽象VS信息隐藏VS封装

发布于 2024-07-04 11:37:02 字数 355 浏览 8 评论 0原文

您能告诉我软件开发中的抽象信息隐藏有什么区别吗?

我很困惑。 抽象隐藏了细节实现 信息隐藏抽象了事物的全部细节。

更新:我找到了这三个概念的一个很好的答案。 请参阅下面的单独答案,了解来自 那里

Can you tell me what is the difference between abstraction and information hiding in software development?

I am confused. Abstraction hides detail implementation and
information hiding abstracts whole details of something.

Update: I found a good answer for these three concepts. See the separate answer below for several citations taken from there.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(22

爱的故事 2024-07-11 11:37:02

抽象

抽象是一种表现基本细节而不包括背景细节的行为。 抽象类只有方法签名,而实现类可以有自己的实现,这样复杂的细节将对用户隐藏。 抽象侧重于外部视图。 换句话说,抽象是将接口与实际实现分离。

封装

封装解释了将数据成员和方法绑定到单个单元中。 信息隐藏是封装的主要目的。 封装是通过使用私有、公共、受保护等访问说明符来实现的。 类成员变量被设为私有,因此外部世界无法直接访问它们。 封装侧重于内部视图。 换句话说,封装是一种用于保护一个对象中的信息免受其他对象影响的技术。

Abstraction

Abstraction is an act of representing essentail details without including the background details. A abstract class have only method signatures and implementing class can have its own implementation, in this way the complex details will be hidden from the user. Abstraction focuses on the outside view. In otherwords, Abstraction is sepration of interfaces from the actual implementation.

Encapsulation

Encapsulation explains binding the data members and methods into a single unit. Information hiding is the main purpose of encapsulation. Encapsulation is acheived by using access specifiers like private, public, protected. Class member variables are made private so that they cann't be accessible directly to outside world. Encapsulation focuses on the inner view. In otherwords, Encapsulation is a technique used to protect the information in an object from the other object.

梨涡少年 2024-07-11 11:37:02

请参阅 Joel 关于泄漏抽象定律的文章

JoelOnsoftware

基本上,抽象为您提供了以下自由:思考更高层次的概念。 一个非编程类比是,我们大多数人不知道我们的食物从哪里来,也不知道它是如何生产的,但事实上我们(通常)不必担心它,这让我们可以腾出时间去做其他事情,比如编程。

至于信息隐藏,我同意jamting。

See Joel's post on the Law of Leaky Abstractions

JoelOnsoftware

Basically, abstracting gives you the freedom of thinking of higher level concepts. A non-programming analogy is that most of us do not know where our food comes from, or how it is produced, but the fact that we (usually) don't have to worry about it frees us up to do other things, like programming.

As for information hiding, I agree with jamting.

半窗疏影 2024-07-11 11:37:02

抽象:抽象是用于识别对象的外部视图的概念/技术。 仅使所需的接口可用。

信息隐藏:它是抽象的补充,因为通过信息隐藏可以实现抽象。 隐藏除外部视图之外的所有其他内容。

封装:将数据和相关功能绑定到一个单元中。 它有利于抽象和信息隐藏。 允许在设备上应用成员访问等功能,以实现抽象和信息隐藏

Abstraction : Abstraction is the concept/technique used to identify what should be the external view of an object. Making only the required interface available.

Information Hiding : It is complementary to Abstraction, as through information hiding Abstraction is achieved. Hiding everything else but the external view.

Encapsulation : Is binding of data and related functions into a unit. It facilitates Abstraction and information hiding. Allowing features like member access to be applied on the unit to achieve Abstraction and Information hiding

离线来电— 2024-07-11 11:37:02

牛津英语词典(OED)给出的抽象含义最接近此处的含义是“思想分离的行为”。 更好的定义可能是“代表事物的基本特征,而不包括背景或无关紧要的细节”。

信息隐藏的原则是软件组件(例如类)的用户只需要知道如何初始化和访问组件的基本细节,而不需要知道实现的细节。

编辑:在我看来,抽象是决定应该隐藏实现的哪些部分的过程

所以它不是抽象与信息隐藏。 它是隐藏 VIA 抽象的信息。

The meaning of abstraction given by the Oxford English Dictionary (OED) closest to the meaning intended here is 'The act of separating in thought'. A better definition might be 'Representing the essential features of something without including background or inessential detail.'

Information hiding is the principle that users of a software component (such as a class) need to know only the essential details of how to initialize and access the component, and do not need to know the details of the implementation.

Edit: I seems to me that abstraction is the process of deciding which parts of the implementation that should be hidden.

So its not abstraction VERSUS information hiding. It's information hiding VIA abstraction.

冷情 2024-07-11 11:37:02

追寻源头! Grady Booch 说道(《面向对象分析与设计》,第 49 页,第二版):

抽象和封装是互补的概念:抽象
专注于对象的可观察行为...封装
重点关注引起这种行为的实现......
封装最常通过信息隐藏来实现,这
是隐藏对象的所有秘密的过程
有助于其基本特征。

换句话说:抽象=外部的对象; 封装(通过信息隐藏实现)=对象内部,

示例:
在 .NET Framework 中,System.Text.StringBuilder 类提供了对字符串缓冲区的抽象。 这种缓冲区抽象允许您使用缓冲区而无需考虑其实现。 因此,您可以将字符串附加到缓冲区,而无需考虑 StringBuilder 内部如何跟踪指向缓冲区的指针以及在缓冲区满时管理内存(这是通过封装来实现的)通过信息隐藏)。

RP

Go to the source! Grady Booch says (in Object Oriented Analysis and Design, page 49, second edition):

Abstraction and encapsulation are complementary concepts: abstraction
focuses on the observable behavior of an object... encapsulation
focuses upon the implementation that gives rise to this behavior...
encapsulation is most often achieved through information hiding, which
is the process of hiding all of the secrets of object that do not
contribute to its essential characteristics.

In other words: abstraction = the object externally; encapsulation (achieved through information hiding) = the object internally,

Example:
In the .NET Framework, the System.Text.StringBuilder class provides an abstraction over a string buffer. This buffer abstraction lets you work with the buffer without regard for its implementation. Thus, you're able to append strings to the buffer without regard for how the StringBuilder internally keeps track of things such the pointer to the buffer and managing memory when the buffer gets full (which it does with encapsulation via information hiding).

rp

请帮我爱他 2024-07-11 11:37:02

OP用他发现的几处引文更新了他的问题,即在 Edward V. Berard 的文章,标题为“抽象、封装和信息隐藏”。 我重新发布了 OP 更新的稍微扩展和重新格式化的版本,因为它本身应该是一个答案。

(所有引文均取自上述文章。)

摘要:

“关于抽象的一个混淆点是它既用作过程又用作实体。抽象作为一个过程,表示提取有关一个项目或一组项目的基本细节,同时忽略不重要的细节细节。抽象作为一个实体,表示模型、视图或实际项目的其他一些集中表示。”

信息隐藏:

“选择它的界面或定义是为了尽可能少地揭示其内部工作原理。” — [Parnas, 1972b]

“抽象可以[...]用作识别应隐藏哪些信息的技术。”

“当人们无法区分信息的隐藏和用于帮助识别要隐藏哪些信息的技术(例如抽象)时,就会发生混乱。”

封装:

“它[…]指的是围绕一些事物的集合构建一个胶囊,在概念障碍的情况下。” - [Wirfs-Brock et al, 1990]

“作为一个过程,封装是指将一个或多个项目封装在 [...] 容器内的行为。封装作为一个实体,是指容纳(包含、封装)一个或多个项目的包或外壳。更多项目。”

“如果封装“与信息隐藏是同一件事”,那么人们可能会提出这样的论点:“封装的所有内容也被隐藏了。” 这显然是不正确的。”

结论:

“抽象、信息隐藏和封装是非常不同但高度相关的概念。有人可能会说抽象是一种技术,可以帮助我们识别哪些特定信息应该可见,哪些信息应该隐藏封装是一种封装信息的技术,其方式是隐藏应该隐藏的内容,并使想要可见的内容变得可见。”

The OP updated his question with several citations that he had found, namely in an article by Edward V. Berard titled, "Abstraction, Encapsulation, and Information Hiding". I am re-posting a slightly expanded and reformatted version of the OP's update, since it should be an answer in its own right.

(All citations are taken from the article mentioned above.)

Abstraction:

"One point of confusion regarding abstraction is its use as both process and an entity. Abstraction, as a process, denotes the extracting of the essential details about an item, or a group of items, while ignoring the inessential details. Abstraction, as an entity, denotes a model, a view, or some other focused representation for an actual item."

Information Hiding:

"Its interface or definition was chosen to reveal as little as possible about its inner workings." — [Parnas, 1972b]

"Abstraction can be […] used as a technique for identifying which information should be hidden."

"Confusion can occur when people fail to distinguish between the hiding of information, and a technique (e.g., abstraction) that is used to help identify which information is to be hidden."

Encapsulation:

"It […] refers to building a capsule, in the case a conceptual barrier, around some collection of things." — [Wirfs-Brock et al, 1990]

"As a process, encapsulation means the act of enclosing one or more items within a […] container. Encapsulation, as an entity, refers to a package or an enclosure that holds (contains, encloses) one or more items."

"If encapsulation was 'the same thing as information hiding,' then one might make the argument that 'everything that was encapsulated was also hidden.' This is obviously not true."

Conclusion:

"Abstraction, information hiding, and encapsulation are very different, but highly-related, concepts. One could argue that abstraction is a technique that help us identify which specific information should be visible, and which information should be hidden. Encapsulation is then the technique for packaging the information in such a way as to hide what should be hidden, and make visible what is intended to be visible."

影子是时光的心 2024-07-11 11:37:02

封装:绑定数据和作用于数据的方法。 这允许对其他类中的所有其他方法隐藏数据。
示例:MyList 类,可以添加项目、删除项目和删除所有项目
addremoveremoveAll 方法作用于不能从外部直接访问的列表(私有数组)。

抽象:隐藏不相关的行为和数据。
项目的实际存储、添加或删除方式是隐藏的(抽象的)。
我的数据可能保存在简单数组、ArrayList、LinkedList 等中。
此外,这些方法的实现方式对外部是隐藏的。

Encapsulation: binding data and the methods that act on it. this allows the hiding of data from all other methods in other classes.
example: MyList class that can add an item, remove an item, and remove all items
the methods add, remove, and removeAll act on the list(a private array) that can not be accessed directly from the outside.

Abstraction: is hiding the non relevant behavior and data.
How the items are actually stored, added, or deleted is hidden (abstracted).
My data may be held in simple array, ArrayList, LinkedList, and so on.
Also, how the methods are implemented is hidden from the outside.

国际总奸 2024-07-11 11:37:02

封装——以受控方式强制访问内部数据或防止直接访问成员。

抽象 - 隐藏某些方法的实现细节称为抽象

让我们通过一个示例来理解: -

class Rectangle
{
private int length;
private int breadth;// see the word private that means they cant be accesed from 
outside world.
 //now to make them accessed indirectly define getters and setters methods
void setLength(int length)
{  
// we are adding this condition to prevent users to make any irrelevent changes 
  that is why we have made length private so that they should be set according to 
   certain restrictions
if(length!=0)
{
 this.length=length
 }
void getLength()
{
 return length;
 }
 // same do for breadth
}

现在为抽象定义一个只能访问且用户不知道的方法
该方法的主体是什么以及它是如何工作的
让我们考虑上面的例子,我们可以定义一个方法area来计算矩形的面积。

 public int area()
 {
  return length*breadth;
 }

现在,每当用户使用上述方法时,他只会获得面积而不是计算方式。 我们可以考虑一个 println() 方法的例子,我们只知道它是用于打印的,但我们不知道它如何打印数据。
我已经写了一篇详细的博客,您可以查看下面的链接以获取更多信息
抽象与封装

Encapsulation- enforcing access to the internal data in a controlled manner or preventing members from being accessed directly.

Abstraction- Hiding the implementation details of certain methods is known as abstraction

Let's understand with the help of an example:-

class Rectangle
{
private int length;
private int breadth;// see the word private that means they cant be accesed from 
outside world.
 //now to make them accessed indirectly define getters and setters methods
void setLength(int length)
{  
// we are adding this condition to prevent users to make any irrelevent changes 
  that is why we have made length private so that they should be set according to 
   certain restrictions
if(length!=0)
{
 this.length=length
 }
void getLength()
{
 return length;
 }
 // same do for breadth
}

now for abstraction define a method that can only be accessed and user doesnt know
what is the body of the method and how it is working
Let's consider the above example, we can define a method area which calculates the area of the rectangle.

 public int area()
 {
  return length*breadth;
 }

Now, whenever a user uses the above method he will just get the area not the way how it is calculated. We can consider an example of println() method we just know that it is used for printing and we don't know how it prints the data.
I have written a blog in detail you can see the below link for more info
abstraction vs encapsulation

美人如玉 2024-07-11 11:37:02

我也对抽象和封装这两个概念感到非常困惑。 但是当我在 myjavatrainer.com 上看到 抽象文章 时,情况变得很清楚对我来说,抽象和封装就像苹果和橘子,你无法真正比​​较它们,因为两者都是必需的。

封装是对象的创建方式,抽象是外部世界如何查看对象。

I too was very confused about the two concepts of Abstraction and Encapsulation. But when I saw the abstraction article on myjavatrainer.com, It became clear to me that Abstraction and Encapsulation are Apples and Oranges, you can't really compare them because both are required.

Encapsulation is how the object is created, and abstraction is how the object is viewed in the outside world.

樱桃奶球 2024-07-11 11:37:02

封装:将数据成员和成员函数绑定在一起称为封装。 封装是通过类来完成的。
抽象:从使用或视图中隐藏实现细节称为抽象。
前任:
整数x;
我们不知道 int 内部如何工作。 但我们知道 int 会起作用。 这就是抽象。

Encapsulation: binding the data members and member functions together is called encapsulation. encapsulation is done through class.
abstraction: hiding the implementation details form usage or from view is called abstraction.
ex:
int x;
we don't know how int will internally work. but we know int will work. that is abstraction.

蔚蓝源自深海 2024-07-11 11:37:02

简而言之

封装:–信息隐藏

抽象:–隐藏实现

抽象让您专注于对象做什么而封装意味着对象如何工作

In very short

Encapsulation:– Information hiding

Abstraction :– Implementation hiding

Abstraction lets you focus on what the object does while Encapsulation means how an object works

浅暮の光 2024-07-11 11:37:02

抽象允许您将复杂的过程视为简单的过程。 例如,标准的“文件”抽象将文件视为连续的字节数组。 用户/开发人员甚至不必考虑集群和碎片问题。 (抽象通常显示为类或子例程。)

信息隐藏是为了保护您的抽象免受恶意/不称职的用户的侵害。 通过将某些状态(例如硬盘分配)的控制限制给原始开发人员,大量的错误处理变得多余。 如果除了文件系统驱动程序之外没有其他人可以写入硬盘驱动器,则文件系统驱动程序确切地知道写入硬盘驱动器的内容以及写入位置。 (这个概念的通常表现是 OO 语言中的 privateprotected 关键字。)

Abstraction allows you to treat a complex process as a simple process. For example, the standard "file" abstraction treats files as a contiguous array of bytes. The user/developer does not even have to think about issues of clusters and fragmentation. (Abstraction normally appears as classes or subroutines.)

Information hiding is about protecting your abstractions from malicious/incompetent users. By restricting control of some state (hard drive allocations, for example) to the original developer, huge amounts of error handling becomes redundant. If nobody else besides the file system driver can write to the hard drive, then the file system driver knows exactly what has been written to the hard drive and where. (The usual manifestation of this concept is private and protected keywords in OO languages.)

小帐篷 2024-07-11 11:37:02

请不要将简单的概念复杂化。

封装:将数据和方法包装到一个单元中就是封装(例如类)

抽象:它是一种仅表示本质事物而不包括背景细节的行为。 (例如接口)

示例和更多信息请转到:

http://thecodekey.com/C_VB_Codes/Encapsulation.aspx

http://thecodekey.com/C_VB_Codes/Abstraction.aspx

批准的定义 这里

PS:我还记得我们在第十一课时读到的 Sumita Arora 的一本名为 C++ 的书中的定义;)

Please don't complicate simple concepts.

Encapsulation : Wrapping up of data and methods into a single unit is Encapsulation (e.g. Class)

Abstraction : It is an act of representing only the essential things without including background details. (e.g. Interface)

FOR EXAMPLES AND MORE INFO GOTO :

http://thecodekey.com/C_VB_Codes/Encapsulation.aspx

http://thecodekey.com/C_VB_Codes/Abstraction.aspx

Approved definitions here

P.S.: I also remember the definition from a book named C++ by Sumita Arora which we read in 11th class ;)

耳根太软 2024-07-11 11:37:02

抽象通过在基本功能上提供一个层来隐藏实现细节。

信息隐藏正在隐藏受该实现影响的数据。 privatepublic 的使用属于此范围。 例如,隐藏类的变量。

封装就是将所有相似的数据和功能归为一组,例如编程中的Class; 网络中的数据包

通过使用类,我们实现了所有三个概念 - 抽象、信息隐藏和封装

Abstraction is hiding the implementation details by providing a layer over the basic functionality.

Information Hiding is hiding the data which is being affected by that implementation. Use of private and public comes under this. For example, hiding the variables of the classes.

Encapsulation is just putting all similar data and functions into a group e.g Class in programming; Packet in networking.

Through the use of Classes, we implement all three concepts - Abstraction, Information Hiding and Encapsulation

吃颗糖壮壮胆 2024-07-11 11:37:02

在一一阅读完上述所有答案后,我无法阻止自己发布该内容

抽象涉及定义代表抽象“参与者”的对象的工具,这些“参与者”可以执行工作、报告和更改其状态以及与系统中的其他对象“通信”。

然而,从上面的封装是相当清楚的 ->

术语封装是指隐藏状态细节,但是将数据类型的概念从早期的编程语言扩展到将行为与数据最强烈地关联起来,并标准化不同数据类型交互的方式,这是抽象的开始。

参考 wiki

After reading all the above answers one by one I cant stop myself from posting that

abstraction involves the facility to define objects that represent abstract "actors" that can perform work, report on and change their state, and "communicate" with other objects in the system.

Encapsulation is quite clear from above however ->

The term encapsulation refers to the hiding of state details, but extending the concept of data type from earlier programming languages to associate behavior most strongly with the data, and standardizing the way that different data types interact, is the beginning of abstraction.

reference wiki

_蜘蛛 2024-07-11 11:37:02

抽象和封装都是四个基本 OOP 概念中的两个,它们允许您将现实世界的事物建模为对象,以便您可以在程序和代码中实现它们。 许多初学者对抽象和封装感到困惑,因为它们看起来非常相似。 如果你问某人什么是抽象,他会告诉你这是一个 OOP 概念,通过隐藏不必要的细节来关注相关信息,而当你问到封装时,很多人会告诉你这是另一个 OOP 概念,隐藏来自外界的数据。 这些定义并没有错,因为抽象和封装都隐藏了一些东西,但关键的区别在于意图。

抽象通过为您提供更抽象的图片(类似于 10,000 英尺的视图)来隐藏复杂性,而封装则隐藏内部工作,以便您以后可以更改它。 换句话说,抽象隐藏了设计层面的细节,而封装则隐藏了实现层面的细节。

Both Abstraction and Encapsulation are two of the four basic OOP concepts which allow you to model real-world things into objects so that you can implement them in your program and code. Many beginners get confused between Abstraction and Encapsulation because they both look very similar. If you ask someone what is Abstraction, he will tell that it's an OOP concept which focuses on relevant information by hiding unnecessary detail, and when you ask about Encapsulation, many will tell that it's another OOP concept which hides data from outside world. The definitions are not wrong as both Abstraction and Encapsulation does hide something, but the key difference is on intent.

Abstraction hides complexity by giving you a more abstract picture, a sort of 10,000 feet view, while Encapsulation hides internal working so that you can change it later. In other words, Abstraction hides details at the design level, while Encapsulation hides details at the implementation level.

一紙繁鸢 2024-07-11 11:37:02

正如您所说,抽象是隐藏实现的细节。

您将某些事物抽象到足够高的程度,以至于您只需做一些非常简单的事情即可执行操作。

信息隐藏就是隐藏实现细节。 编程很难。 你可以有很多事情要处理和处理。 您可能想要/需要密切跟踪某些变量。 隐藏信息可确保没有人因使用您公开公开的变量或方法而意外破坏某些内容。

这两个概念在面向对象编程中紧密相连。

Abstraction is hiding details of implementation as you put it.

You abstract something to a high enough point that you'll only have to do something very simple to perform an action.

Information hiding is hiding implementation details. Programming is hard. You can have a lot of things to deal with and handle. There can be variables you want/need to keep very close track of. Hiding information ensures that no one accidentally breaks something by using a variable or method you exposed publicly.

These 2 concepts are very closely tied together in object-oriented programming.

醉酒的小男人 2024-07-11 11:37:02

抽象 - 识别对象本质特征的过程
不包括不相关且乏味的细节。

封装 - 将数据和操作该数据的函数封装到单个单元中的过程。

抽象和封装是相关但互补的概念。

  1. 抽象就是过程。 封装是实现抽象的机制。

  2. 抽象关注对象的可观察行为。 封装侧重于引起此行为的实现。

信息隐藏 - 这是隐藏对象实现细节的过程。 这是封装的结果。

Abstraction - It is the process of identifying the essential characteristics of an object
without including the irrelevant and tedious details.

Encapsulation - It is the process of enclosing data and functions manipulating this data into a single unit.

Abstraction and Encapsulation are related but complementary concepts.

  1. Abstraction is the process. Encapsulation is the mechanism by which Abstraction is implemented.

  2. Abstraction focuses on the observable behavior of an object. Encapsulation focuses upon the implementation that give rise to this behavior.

Information Hiding - It is the process of hiding the implementation details of an object. It is a result of Encapsulation.

玩心态 2024-07-11 11:37:02

只需添加有关 InformationHiding 的更多详细信息,发现此链接是带有示例的非常好的来源

信息隐藏是这样的想法:设计决策应该对系统的其余部分隐藏,以防止意外的耦合。 信息隐藏是一个设计原则。 信息隐藏应该告知您封装事物的方式,但当然不是必须如此

封装是一种编程语言功能。

Just adding on more details around InformationHiding, found This link is really good source with examples

InformationHiding is the idea that a design decision should be hidden from the rest of the system to prevent unintended coupling. InformationHiding is a design principle. InformationHiding should inform the way you encapsulate things, but of course it doesn't have to.

Encapsulation is a programming language feature.

无人接听 2024-07-11 11:37:02

抽象简单地说就是只让用户看到软件的基本细节以帮助用户使用或操作软件,从而不显示该软件的实现细节(变得不可见)的技术。
封装是一种将一个或多个项目封装起来的技术,因此一些信息(特别是程序细节)对用户可见,而另一些则对用户不可见,因此封装是通过信息隐藏来实现的。
总之。 抽象用于可观察的行为(外部),而封装用于不可见性(内部),但这两者确实是互补的。

Abstraction simply means the technique in which only essential details of software is made visible to the user to help the user to use or operate with software, thus implementation details of that software are not shown(are made invisible).
Encapsulation is the technique that have package that hold one or more items and hence some of information (particularly program details) became visible and some not visible to the user, so encapsulation is achieved through information hiding.
In summary. Abstraction is for observable behavior (externally) and encapsulation is for invisibility (internally) but these two are really complementary.

临走之时 2024-07-11 11:37:02

为了抽象某些东西,我们需要隐藏细节,或者隐藏我们需要抽象的东西的细节。
但是,这两者都可以通过封装来实现。

所以,信息隐藏是目标,抽象是过程,封装是技术。

To abstract something we need to hide the detail or to hide the detail of something we need to abstract it.
But, both of them can be achieved by encapsulation.

So, information hiding is a goal, abstraction is a process, and encapsulation is a technique.

葵雨 2024-07-11 11:37:02

值得注意的是,这些术语具有标准化的 IEEE 定义,可以在 https://pascal.computer.org/< /a>.

对象的抽象

  1. 视图,重点关注与特定目的相关的信息,并忽略其余信息
  2. 过程,即制定抑制不相关细节的视图
  3. 过程以建立简化模型,或该模型的结果过程

信息隐藏

  1. 软件开发技术,其中每个模块的接口尽可能少地透露该模块的内部工作原理,并且防止其他模块使用不在模块接口规范包含的模块中的有关该模块的信息
  2. 。在单个模块中设计或实现决策,以便该决策对其他模块隐藏

封装

  1. 软件开发技术,包括隔离系统功能或模块内的一组数据以及对这些数据的操作,并提供模块
  2. 概念的精确规范,即对类职责的名称、含义和值的访问与对其实现的访问完全分开;
  3. 模块具有与其内部不同的外部,它具有外部接口和内部实现

It's worth noting these terms have standardized, IEEE definitions, which can be searched at https://pascal.computer.org/.

abstraction

  1. view of an object that focuses on the information relevant to a particular purpose and ignores the remainder of the information
  2. process of formulating a view
  3. process of suppressing irrelevant detail to establish a simplified model, or the result of that process

information hiding

  1. software development technique in which each module's interfaces reveal as little as possible about the module's inner workings and other modules are prevented from using information about the module that is not in the module's interface specification
  2. containment of a design or implementation decision in a single module so that the decision is hidden from other modules

encapsulation

  1. software development technique that consists of isolating a system function or a set of data and operations on those data within a module and providing precise specifications for the module
  2. concept that access to the names, meanings, and values of the responsibilities of a class is entirely separated from access to their realization
  3. idea that a module has an outside that is distinct from its inside, that it has an external interface and an internal implementation
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文