当前位置:网站首页>自学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、易扩展
由于继承、封装、多态的特性,自然设计出高内聚、低耦合的系统结构,使得系统更灵活、更容易扩展,而且成本较低。
边栏推荐
- Mqtt protocol stack principle and interaction flow chart
- 手把手带你入门 API 开发
- 巅峰小店APP仿站开发玩法模式讲解源码分享
- I.MX6ULL启动方式
- 记一次 .NET 某物管后台服务 卡死分析
- In 2021, the global professional liability insurance revenue was about USD 44740million, and it is expected to reach USD 55980million in 2028. From 2022 to 2028, the CAGR was 3.5%
- MapReduce practical cases (customized sorting, secondary sorting, grouping, zoning)
- Research Report on the overall scale, major producers, major regions, products and application segments of swine vaccine in the global market in 2022
- 0 basic understanding of how e-commerce systems connect with payment channels
- R语言使用epiDisplay包的poisgof函数对泊松回归(Poisson Regression)执行拟合优度检验、检验是否存在过度离散问题(overdispersion)
猜你喜欢
![[tcapulusdb knowledge base] tcapulusdb operation and maintenance doc introduction](/img/04/b1194ca3340b23a4fb2091d1b2a44d.png)
[tcapulusdb knowledge base] tcapulusdb operation and maintenance doc introduction

C/s architecture

MapReduce principle analysis (in-depth source code)

Prevent being rectified after 00? I. The company's recruitment requires that employees cannot sue the company

Youboxun attended the openharmony technology day to create a new generation of secure payment terminals
![Jerry's serial port communication serial port receiving IO needs to set digital function [chapter]](/img/d1/5beed6c86c4fdc024c6c9c66fbffb8.png)
Jerry's serial port communication serial port receiving IO needs to set digital function [chapter]

pull request

In 2021, the global professional liability insurance revenue was about USD 44740million, and it is expected to reach USD 55980million in 2028. From 2022 to 2028, the CAGR was 3.5%

Comment modifier Node Fichiers dans les modules
![[tcapulusdb knowledge base] tcapulusdb doc acceptance - table creation approval introduction](/img/da/449a1e215885597a67344e2a6edf0f.png)
[tcapulusdb knowledge base] tcapulusdb doc acceptance - table creation approval introduction
随机推荐
Youboxun attended the openharmony technology day to create a new generation of secure payment terminals
Informatics Olympiad all in one 1332: [example 2-1] weekend dance
杰理之DAC输出方式设置【篇】
57. The core principle of flutter - layout process
c/s 架构
FileOutputStream
I.MX6ULL启动方式
[tcapulusdb knowledge base] tcapulusdb doc acceptance - transaction execution introduction
[tcapulusdb knowledge base] tcapulusdb doc acceptance - Introduction to creating game area
Nifi from introduction to practice (nanny level tutorial) - identity authentication
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
Excel中输入整数却总是显示小数,如何调整?
R language uses GLM function to build Poisson logarithm linear regression model, processes three-dimensional contingency table data to build saturation model, uses step function to realize stepwise re
如何修改 node_modules 裏的文件
What is the TCP 3-time handshake process?
R language uses the poisgof function of epidisplay package to test the goodness of fit of Poisson regression and whether there is overdispersion
Nvme2.0 protocol - new features
0 basic understanding of how e-commerce systems connect with payment channels
星际争霸的虫王IA退役2年搞AI,自叹不如了
"24 of the 29 students in the class successfully went to graduate school" rushed to the hot search! Where are the remaining five?