📜  面向过程和面向对象编程的区别

📅  最后修改于: 2021-09-12 11:08:51             🧑  作者: Mango

程序化编程:
过程编程可以定义为一种编程模型,它基于调用过程的概念从结构化编程中派生出来。程序,也称为例程、子例程或函数,仅由一系列要执行的计算步骤组成。在程序执行期间,任何给定的过程都可能在任何时候被调用,包括被其他过程或自身调用。

过程编程中使用的语言:

FORTRAN, ALGOL, COBOL, 
BASIC, Pascal and C. 

面向对象编程:
面向对象编程可以定义为基于对象概念的编程模型。对象包含属性形式的数据和方法形式的代码。在面向对象的编程中,计算机程序是使用与现实世界交互的对象的概念来设计的。面向对象的编程语言多种多样,但最流行的是基于类的,这意味着对象是类的实例,这也决定了它们的类型。

面向对象编程中使用的语言:

Java, C++, C#, Python, 
PHP, JavaScript, Ruby, Perl, 
Objective-C, Dart, Swift, Scala. 

过程式编程和面向对象编程的区别:

Procedural Oriented Programming Object Oriented Programming
In procedural programming, program is divided into small parts called functions. In object oriented programming, program is divided into small parts called objects.
Procedural programming follows top down approach. Object oriented programming follows bottom up approach.
There is no access specifier in procedural programming. Object oriented programming have access specifiers like private, public, protected etc.
Adding new data and function is not easy. Adding new data and function is easy.
Procedural programming does not have any proper way for hiding data so it is less secure. Object oriented programming provides data hiding so it is more secure.
In procedural programming, overloading is not possible. Overloading is possible in object oriented programming.
In procedural programming, function is more important than data. In object oriented programming, data is more important than function.
Procedural programming is based on unreal world. Object oriented programming is based on real world.
Examples: C, FORTRAN, Pascal, Basic etc. Examples: C++, Java, Python, C# etc.