当前位置:网站首页>Understand ADT and OOP
Understand ADT and OOP
2022-06-23 13:38:00 【Jingjingzi*】
Catalog
ADT And OOP The relationship between
ADT
1. Concept
A mathematical model and a set of operations defined on it , The definition of an abstract data type depends on only one set of its logical characteristics , It has nothing to do with how it is represented and implemented inside the computer
2. form
An abstract data type defines : A data object 、 The relationship between the data elements in the data object and the operation on the data elements
3. significance
Abstract data types embody problem decomposition in programming 、 The characteristics of abstraction and information hiding . Abstract data types decompose real-life problems into many small-scale and easy to deal with problems , Then build a data model that can be processed by computer , And the implementation details of each functional module as an independent unit , So that the specific implementation process can be hidden
OOP
1. Concept
Object oriented programming methods / Languages should have the concept of classes as the central concept . A language should be able to provide assertions for a class and its characteristics ( Namely specification : precondition , Post conditions and invariants ) And exception handling , Rely on tools to generate documents in these assertions , And optionally monitor them at run time Time .
2. The core concept
① Static type : A well-defined type system should ensure the runtime type safety of the system it accepts by enforcing some type declarations and compatibility rules .
② Generic (Genericity): be used for “ Prepare for change ” and “ by / Reuse design ”: It should be possible to write classes with formal generic parameters that represent any type .
③ Inherit (Inheritance): It should be possible to define a class as inheriting from another , To control the potential complexity .
④ polymorphic (Polymorphism): Under the control of an inheritance based type system , It should be possible to ( The name in the software text that represents the runtime object ) Attach to various possible types of runtime objects .
⑤ Dynamic dispatch / binding (Dynamic dispatch / binding): Calling a feature on an entity should always trigger the feature corresponding to the type of the attached runtime object , This is not necessarily the same in the different execution of the call .
ADT And OOP The relationship between
Four ideas of object-oriented programming : encapsulation 、 Inherit 、 polymorphic 、 abstract
ADT It just reflects the two programming ideas of encapsulation and abstraction . Want to achieve ADT It has nothing to do with the implementation language ( No matter what language you use, you can embody a certain programming idea ). So in your question “ Realize the encapsulation in object-oriented programming ” This statement has its own problems , Can't say “ Realization ” A certain idea , It can only be said “ reflect ”.Besides ,ADT( Abstract data types ) Just a data type , This data type is a mathematical model and a set of operations defined on it . encapsulation 、 Inherit 、 polymorphic 、 Abstraction is the idea used in object-oriented programming ,ADT Not a language at all , It's just a model , The two can not be compared
边栏推荐
- Hanyuan hi tech 8-way telephone +1-way 100M Ethernet RJ11 telephone optical transceiver 8-way PCM telephone optical transceiver
- 有向图D和E
- 实战 | 如何制作一个SLAM轨迹真值获取装置?
- Is it safe for flush to open an account online? What should we pay attention to
- Go写文件的权限 WriteFile(filename, data, 0644)?
- Runtime application self-protection (rasp): self-cultivation of application security
- Gradle Build Cache引发的Task缓存编译问题怎么解决
- Online text entity extraction capability helps applications analyze massive text data
- In flinksql, the Kafka flow table and MySQL latitude flow table are left joined, and the association is made according to I'd. false
- One way linked list implementation -- counting
猜你喜欢

Dataset之GermanCreditData:GermanCreditData数据集的简介、下载、使用方法之详细攻略

How to use androd gradle module dependency replacement

在線文本過濾小於指定長度工具

2 万字 + 30 张图 |MySQL 日志:undo log、redo log、binlog 有什么用?

栈和队列的基本使用

2-optical-2-electric cascaded optical fiber transceiver Gigabit 2-optical-2-electric optical fiber transceiver Mini embedded industrial mine intrinsic safety optical fiber transceiver

quartus調用&設計D觸發器——仿真&時序波驗證

20000 words + 30 pictures | MySQL log: what is the use of undo log, redo log and binlog?

Digraph D and e

前AMD芯片架构师吐槽,取消 K12 处理器项目是因为 AMD 怂了!
随机推荐
Gary Marcus wrote: three perspectives from linguists that AI researchers need to know
sed -i命令怎么使用
能把SAP系统玩成鸡肋的公司,太有才了!
How did Tencent's technology bulls complete the overall cloud launch?
You call this shit MQ?
AGCO AI frontier promotion (6.23)
Androd Gradle模块依赖替换如何使用
Service stability governance
Loss, duplication and backlog of message queues
R language dplyr package mutate_ The all function multiplies all numeric columns (variables) in the dataframe by a fixed value to generate a new data column, and specifies a user-defined suffix name f
ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
#云原生征文#深入了解Ingress
Principle analysis of three methods for exchanging two numbers
First exposure! The only Alibaba cloud native security panorama behind the highest level in the whole domain
Online text entity extraction capability helps applications analyze massive text data
TUIKit 音视频低代码解决方案导航页
Scope of groovy
1 channel 100m optical fiber transceiver 1 100m optical 1 100m electric desktop Ethernet optical fiber transceiver built-in power supply
Digraph D and e
In flinksql, the Kafka flow table and MySQL latitude flow table are left joined, and the association is made according to I'd. false