当前位置:网站首页>自学ADT和OOP
自学ADT和OOP
2022-06-27 11:41:00 【风一吹你就要走】
1、ADT
Abstract Data Type,抽象数据类型,是指数据结构作为一个软件组件的实现。ADT的接口用一种类型和该类型上的一组操作来定义,每个操作由它的输入和输出定义。
ADT并不会指定数据类型如何实现,这些实现细节对于ADT的用户来说是隐藏的,并且通过封装(encapsulation)来阻止外部对他的访问。
数据结构(Data Structure)是ADT的实现,在诸如c++之类的面向对象语言中,ADT及其实现组成了类(class)。同ADT联系在一起的每个操作均由一个成员函数(member function)来实现。数据结构是指存储在计算机内存中的数据,文件结构是指外存储器中数据的组织。
对于使用同一ADT的两个应用程序,可能存在一个应用程序使用的ADT特殊方法比另一个多的情况或者这两个程序对该ADT的操作有不同的时间需求。正是由于应用程序的需求存在差异,才使一个给定ADT有多种实现形式的可能性。
问题:从直觉上讲,问题无非是一个需要完成的任务,即一组输入就有一组对应的输出。
算法:算法是指解决问题的一种方法或者一个过程。
程序:一个计算机程序被认为是使用某种程序设计语言对一种算法的具体实现。
2、OOP
OOP:oop 是面向对象编程,面向对象编程是一种计算机编程架构,OOP 的一条基本原则是计算机程序是由单个能够起到子程序作用的单元或对象组合而成。
OOP特性:
1、封装性:也称为信息隐藏,就是将一个类的使用和实现分开,只保留部分接口和方法与外部联系,或者说只公开了一些供开发人员使用的方法。于是开发人员只 需要关注这个类如何使用,而不用去关心其具体的实现过程,这样就能实现 MVC 分工合作,也能有效避免程序间相互依赖,实现代码模块间松藕合。
2、继承性:就是子类自动继承其父级类中的属性和方法,并可以添加新的属性和方法或者对部分属性和方法进行重写。继承增加了代码的可重用性。PHP 只支持单继承,也就是说一个子类只能有一个父类。
3、多态性:子类继承了来自父级类中的属性和方法,并对其中部分方法进行重写。于是多个子类中虽然都具有同一个方法,但是这些子类实例化的对象调用这些相同的方法后却可以获得完全不同的结果,这种技术就是多态性。多态性增强了软件的灵活性。
使用OOP的好处:
1、易维护
采用面向对象思想设计的结构,可读性高,由于继承的存在,即使改变需求,那么维护也只是在局部模块,所以维护起来是非常方便和较低成本的。
2、质量高
在设计时,可重用现有的,在以前的项目的领域中已被测试过的类使系统满足业务需求并具有较高的质量。
3、效率高
在软件开发时,根据设计的需要对现实世界的事物进行抽象,产生类。使用这样的方法解决问题,接近于日常生活和自然的思考方式,势必提高软件开发的效率和质量。
4、易扩展
由于继承、封装、多态的特性,自然设计出高内聚、低耦合的系统结构,使得系统更灵活、更容易扩展,而且成本较低。
边栏推荐
- 星际争霸的虫王IA退役2年搞AI,自叹不如了
- Drive to APasS! Use Mingdao cloud to manage F1 events
- 面试突击60:什么情况会导致 MySQL 索引失效?
- R language uses the polR function of mass package to construct the ordered multi classification logistic regression model, and uses the vglm function of VGAM package to test the parallelism hypothesis
- Popular science of device review: popular science of innovative medical device series - sternum plate products
- Daily leetcode force deduction (21~25)
- $15.8 billion! 2021 the world's top15 most profitable hedge fund giant
- [tcapulusdb knowledge base] Introduction to tcapulusdb data structure
- Summary of qstype class usage (III)
- 旭日3SDB,安装原版ros
猜你喜欢

Salesforce 容器化 ISV 场景下的软件供应链安全落地实践

c/s 架构

Qstype implementation of self drawing interface project practice (I)

pull request

1. Mx6ull startup mode

Youboxun attended the openharmony technology day to create a new generation of secure payment terminals

QStyle实现自绘界面项目实战(一)

MapReduce principle analysis (in-depth source code)

杰理之DAC输出方式设置【篇】

Popular science of device review: popular science of innovative medical device series - sternum plate products
随机推荐
2022CISCN华中 Web
On ticheck
[tcapulusdb knowledge base] tcapulusdb doc acceptance - create business introduction
Popular science of device review: popular science of innovative medical device series - sternum plate products
Histrix工作原理
如何修改 node_modules 里的文件
What is the TCP 3-time handshake process?
动态规划【三】(区间dp)石子合并
57. The core principle of flutter - layout process
The R language uses the DOTPLOT function of epidisplay package to visualize the frequency of data points in different intervals in the form of point graph, specifies the grouping parameters with the b
优博讯出席OpenHarmony技术日,全新打造下一代安全支付终端
Wechat applet payment password input
Safe landing practice of software supply chain under salesforce containerized ISV scenario
L'utilisation de C language 0 length Array
Thinkphp6 interface limits user access frequency
R语言dplyr包arrange函数排序dataframe数据、通过多个数据列排序dataframe数据、指定第一个字段降序排序,第二字段不指定(默认升序排序)
alibaba jarslink
In 2021, the global enhanced oil production surfactant revenue was about USD 202.3 million, and it is expected to reach USD 297.1 million in 2028
Peak store app imitation station development play mode explanation source code sharing
R language uses the polR function of mass package to construct the ordered multi classification logistic regression model, and uses the vglm function of VGAM package to test the parallelism hypothesis